@KoRNeT46RuS

[ZF2] Почему возникает A field name was provided without a field value?

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();
    }
  • Вопрос задан
  • 109 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы