예제 #1
0
파일: User.php 프로젝트: hoangpt/nextcms
 /**
  * Check if there is user with given username or email address
  *
  * @param \User\Entity\User $user
  * @return bool
  */
 public function exist($user)
 {
     if ($user->email == null && $user->user_name == null) {
         return true;
     }
     $criteria = [];
     if ($user->email) {
         $criteria[] = ['email' => $user->email];
     }
     if ($user->user_name) {
         $criteria[] = ['user_name' => $user->user_name];
     }
     $count = $this->userMapper->count(['$or' => $criteria]);
     return $count > 0;
 }