AppBundle\Entity\Post::isAuthor PHP Метод

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

Is the given User the author of this Post?
public isAuthor ( User $user ) : boolean
$user User
Результат boolean
    public function isAuthor(User $user)
    {
        return $user->getEmail() == $this->getAuthorEmail();
    }

Usage Example

Пример #1
0
 /**
  * @param Post $post
  * @param User $user
  *
  * @return bool
  */
 private function isEditGranted(Post $post, User $user)
 {
     switch ($post->getState()) {
         case Post::STATUS_DRAFT:
             return $post->isAuthor($user);
         case Post::STATUS_REVIEW:
             return $user->isAdmin();
     }
     return false;
 }
All Usage Examples Of AppBundle\Entity\Post::isAuthor