/**
  * {@inheritDoc}
  */
 public function id()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'id', array());
     return parent::id();
 }
 /**
  * Returns all events of a certian group
  *
  * @param Group $group
  * @return ArrayCollection
  */
 public function eventsOfGroup(Group $group)
 {
     $qb = $this->em->createQueryBuilder();
     $qb->select('c')->from($this->calendarClass, 'c')->join('c.groups', 'g')->where($qb->expr()->eq('g.id', '?1'), $qb->expr()->orX($qb->expr()->andX($qb->expr()->isNull('c.end'), $qb->expr()->gte('c.start', '?2')), $qb->expr()->gt('c.end', '?2')))->setParameter(1, $group->id())->setParameter(2, new DateTime());
     return $qb->getQuery()->getResult();
 }