/**
  * @param CalendarEvent $event
  */
 public function onCalendarLoadEvents(CalendarEvent $calendar_event)
 {
     $start_date = $calendar_event->getStartDatetime();
     $end_date = $calendar_event->getEndDatetime();
     $request = $calendar_event->getRequest();
     $filter = $request->get('filter');
     // Get DVI Events
     $company_events = $this->eventEntityManager->getRepository()->createQueryBuilder('e')->where('e.startedAt BETWEEN :startDate AND :endDate')->setParameter('startDate', $start_date->format('Y-m-d H:i:s'))->setParameter('endDate', $end_date->format('Y-m-d H:i:s'))->getQuery()->getResult();
     // Create Calendar Events
     foreach ($company_events as $company_event) {
         $company_event->setUrl($this->router->generate('asf_scheduler_calendar_event_edit', array('id' => $company_event->getId())));
         $calendar_event->addEvent($company_event);
     }
 }
 /**
  * {@inheritDoc}
  * @see \Symfony\Component\Form\AbstractType::configureOptions()
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(array('data_class' => $this->entityManager->getClassName(), 'translation_domain' => 'asf_scheduler'));
 }
 /**
  * {@inheritDoc}
  * @see \Symfony\Component\Form\AbstractType::configureOptions()
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(array('label' => 'Calendar Event Category', 'class' => $this->eventCategoryManager->getClassName(), 'choice_label' => 'title', 'placeholder' => 'Choose a category', 'attr' => array('class' => 'select2-entity')));
 }
 /**
  * {@inheritDoc}
  * @see \Symfony\Component\Form\AbstractType::configureOptions()
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(array('label' => 'Calendar Event', 'class' => $this->calendarEventManager->getClassName(), 'choice_label' => 'name', 'placeholder' => 'Choose an event', 'attr' => array('class' => 'select2-entity-ajax', 'data-route' => 'asf_scheduler_ajax_request_calendar_event_by_name')));
 }
 /**
  * (non-PHPdoc)
  * @see \Symfony\Component\Form\DataTransformerInterface::reverseTransform()
  */
 public function reverseTransform($string)
 {
     $event_category = $this->eventCategoryManager->getRepository()->findOneBy(array('title' => $string));
     return $event_category;
 }