Esempio n. 1
0
 /**
  * Loads aliases with mailbox.
  *
  * Selects aliases where address not equal to goto, and goto not equals to
  * mailbox username, but goto has mailbox username. If admin is not super
  * then it checks if admin have have linked with domain.
  *
  * @param \Entities\Mailbox $mailbox Mailbox for alias filtering.
  * @param \Entities\Admin   $admin   Admin for checking privileges.
  * @return \Entities\Alias[]
  */
 public function loadWithMailbox($mailbox, $admin)
 {
     $qb = $this->getEntityManager()->createQueryBuilder()->select('a')->from('\\Entities\\Alias', 'a')->where('a.address != a.goto')->andWhere('a.goto != ?1')->andWhere('a.goto like ?2')->setParameter(1, $mailbox->getUsername())->setParameter(2, '%' . $mailbox->getUsername() . '%');
     if (!$admin->isSuper()) {
         $qb->leftJoin('a.Domain', 'd')->leftJoin('d.Admins', 'd2a')->andWhere('d2a = :admin')->setParameter('admin', $admin);
     }
     return $qb->getQuery()->getResult();
 }
 /**
  * {@inheritDoc}
  */
 public function getUsername()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getUsername', array());
     return parent::getUsername();
 }