public function enforceOwnerSecurity(Event $event) { $user = $this->getUser(); if ($user != $event->getOwner()) { throw $this->createAccessDeniedException('You are not the owner!!!'); } }
public function enforceOwnerSecurity(Event $event) { $user = $this->getUser(); if ($user != $event->getOwner()) { // if you're using 2.5 or higher // throw $this->createAccessDeniedException('You are not the owner!!!'); throw new AccessDeniedException('You are not the owner!!!'); } }