Skip to content

Commit

Permalink
resolve getCompany error in eventsAction
Browse files Browse the repository at this point in the history
  • Loading branch information
rserry committed Jan 26, 2024
1 parent ca33eaf commit 248214a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions module/BrBundle/Component/Controller/CorporateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use CommonBundle\Component\Controller\Exception\HasNoAccessException;
use CommonBundle\Component\Util\AcademicYear;
use Laminas\Mvc\MvcEvent;
use Laminas\View\Model\ViewModel;

/**
* We extend the CommonBundle controller.
Expand Down Expand Up @@ -54,9 +53,9 @@ public function onDispatch(MvcEvent $e)

/**
* @param boolean $login
* @return Corporate|boolean
* @return Corporate|null
*/
protected function getCorporateEntity($login = true)
protected function getCorporateEntity(bool $login = true)
{
if ($this->getAuthentication()->isAuthenticated()) {
$person = $this->getAuthentication()->getPersonObject();
Expand All @@ -66,7 +65,7 @@ protected function getCorporateEntity($login = true)
}
}

if ($login == false) {
if (!$login) {
throw new HasNoAccessException('You do not have sufficient permissions to access this resource');
}

Expand All @@ -76,7 +75,7 @@ protected function getCorporateEntity($login = true)
'action' => 'login',
)
);
return new ViewModel();
return null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion module/BrBundle/Controller/Corporate/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function eventsAction()

$person = $this->getCorporateEntity();

if ($person === null) {
if (is_null($person)) {
foreach ($events as $event) {
$event->atEvent = false;
}
Expand Down

0 comments on commit 248214a

Please sign in to comment.