コード例 #1
0
 /**
  * {@inheritDoc}
  */
 public function getEmail()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getEmail', array());
     return parent::getEmail();
 }
コード例 #2
0
ファイル: Note.php プロジェクト: dotuancd/secretary
 /**
  * @param array $members
  * @param Entity\User $owner
  * @param int $groupId
  * @return array $members
  * @throws \LogicException If given User(Member) ID does not
  * @throws \LogicException If given User(Member) has not set key
  * @throws \LogicException If given User(Member) is not member of given group
  */
 public function getUsersWithKeys(array $members, Entity\User $owner, $groupId)
 {
     $users = array();
     $keys = array();
     $group = $this->getGroupRepository()->find((int) $groupId);
     foreach ($members as $member) {
         /* @var $user \Secretary\Entity\User */
         $user = $this->getUserRepository()->find((int) $member);
         if (false === $user->getGroups()->contains($group)) {
             $this->events->trigger('logViolation', __METHOD__ . '::l42', array('message' => sprintf('User: %s wants to add user: %s to group: %s', $owner->getEmail(), $user->getEmail(), $group->getName())));
             throw new \LogicException('User does not belong to selected group');
         }
         if (empty($user)) {
             throw new \LogicException('User does not exists: ' . $member);
         }
         $key = $user->getKey();
         if (empty($key)) {
             throw new \LogicException('User key does not exists: ' . $member);
         }
         $users[$user->getId()] = $user;
         $keys[$user->getId()] = $key->getPubKey();
     }
     $users[$owner->getId()] = $owner;
     $keys[$owner->getId()] = $owner->getKey()->getPubKey();
     return array('users' => $users, 'keys' => $keys);
 }