getPost() публичный Метод

public getPost ( )
Пример #1
0
 private function canYouDoIt(Comment $comment, User $user)
 {
     $commentOwner = $this->doctrine->getRepository('AppBundle:User')->findOneBy(array('email' => $comment->getAuthorEmail()));
     if (in_array("ROLE_ADMIN", $commentOwner->getRoles()) || $comment->getPost()->getAuthorEmail() !== $user->getEmail()) {
         return false;
     }
     return true;
 }
Пример #2
0
 private function canEdit(Comment $comment, User $user)
 {
     // this assumes that the data object has a getOwner() method
     // to get the entity of the user who owns this data object
     if ($comment->getUser()->getIsAdmin() and !$user->getIsAdmin()) {
         return false;
     }
     return $user === $comment->getUser() or $user->getIsAdmin() or $user === $comment->getPost()->getAuthor();
 }
Пример #3
0
 private function canEdit(Comment $comment, UserInterface $user, TokenInterface $token)
 {
     if ($this->decisionManager->decide($token, ['ROLE_MANAGER']) && (!$comment->getUser() || !$this->roleHierarchyChecker->check($comment->getUser(), 'ROLE_ADMIN')) && $comment->getPost()->getOwner() == $user) {
         return true;
     }
     if ($comment->getUser() === $user) {
         return true;
     }
     return false;
 }
 /**
  * {@inheritDoc}
  */
 public function getPost()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getPost', array());
     return parent::getPost();
 }