Answer the question
In order to leave comments, you need to log in
[ZF2] Why does A field name was provided without a field value occur?
public function processBannerAction()
{
$id = $this->params()->fromRoute('id-banner');
if ($id) {
/** @var \Application\Entity\BannerCondition $conditions */
$conditions = $this->_getBannerConditionsMapper()->fetchAll(['banner_id' => $id])->current();
/** @var \Application\Entity\Banner $banner */
$banner = $this->_getBannerMapper()->fetchAll(['banner_id' => $id])->current();
if ($conditions) {
$isAuth = $this->_getUserService()->isAuthenticated();
if ($isAuth) {
if ($conditions->getHaveRoleId() == 0) {
return $this->redirect()->toUrl($conditions->getHaveRoleUrl());
} else {
/** @var \Auth\Entity\UserRole[] $userRoles */
$userRoles = $this->_getUserMapper()->getUserRoles($this->_getUserService()->getId());
foreach ($userRoles as $roleId => $role) {
switch ($roleId) {
case $conditions->getHaveRoleId():;
return $this->redirect()->toUrl($conditions->getHaveRoleUrl());
break;
case $conditions->getNotHaveRoleId():
return $this->redirect()->toUrl($conditions->getNotHaveRoleUrl());
break;
default:
return $this->redirect()->toUrl($banner->getUri());
break;
}
}
}
} elseif ($conditions->getNotHaveRoleId() === 0) {
return $this->redirect()->toUrl($conditions->getNotHaveRoleUrl());
} else {
if ($conditions->getNotRegisteredUrl()) {
return $this->redirect()->toUrl($conditions->getNotRegisteredUrl());
} else {
return $this->redirect()->toUrl('/');
}
}
} else {
if ($banner->getUri()) {
return $this->redirect()->toUrl($banner->getUri());
} else {
return $this->redirect()->toUrl('/');
}
}
}
return $this->notFoundAction();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question