Exemplo n.º 1
0
 /**
  * Does this course have the named user as a person yet?
  *
  * @param \AppBundle\Entity\Person $user
  *
  * @return Boolean
  */
 public function hasUser(\AppBundle\Entity\Person $user)
 {
     foreach ($this->users as $u) {
         if ($u->getId() === $user->getId()) {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * Turn this item object into a generic array
  *
  * @return array
  */
 public function transform(Person $person)
 {
     return ['id' => (int) $person->getId(), 'firstname' => $person->getFirstname(), 'lastname' => $person->getLastname(), 'email' => $person->getEmail(), 'organizationId' => $person->getOrganization()->getId(), 'fileCount' => $person->getNumFiles(), 'createdAt' => $person->getCreatedAt(), 'updatedAt' => $person->getUpdatedAt()];
 }
 /**
  * Create a list of all notifications
  * @param Person $user a user
  * @param Organisation $organisation an organisation
  * @param Vacancy $vacancy a vacancy
  * @return Response
  */
 public function listNotificationsAction($user, $organisation = null, $vacancy = null)
 {
     $digestNotifications = [];
     $qb = $this->getDoctrine()->getManager()->createQueryBuilder();
     $qb->select(array('dE'))->from('AppBundle:DigestEntry', 'dE')->where($qb->expr()->andX($qb->expr()->eq('dE.handled', 0), $qb->expr()->eq('dE.user', $user->getId()), $qb->expr()->neq('dE.event', 1)));
     if ($organisation) {
         $qb->where('dE.Organisation = :organisation')->setParameter('organisation', $organisation->getId());
     }
     if ($vacancy) {
         $qb->where('dE.vacancy = :vacancy')->setParameter('vacancy', $vacancy->getId());
     }
     $qb->add('orderBy', 'dE.id DESC');
     $digests = $qb->getQuery()->getResult();
     foreach ($digests as $digest) {
         $textAndActionLink = $this->getTextAndActionLinkForEvent($digest);
         array_push($digestNotifications, $textAndActionLink);
     }
     return $this->render("person/persoon_notificaties.html.twig", ["notifications" => $digestNotifications]);
 }
 /**
  * {@inheritDoc}
  */
 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) parent::getId();
     }
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array());
     return parent::getId();
 }