/**
  * @DI\Observe("formalibre_delete_event_from_resource")
  */
 public function onResourceDeleted(GenericDatasEvent $event)
 {
     $resource = $event->getDatas()->getDatas();
     foreach ($resource->getReservations() as $reservation) {
         $this->em->remove($reservation->getEvent());
     }
     $this->em->flush();
     $event->stopPropagation();
 }
 public function deleteEventsBoundToResource(Resource $resource)
 {
     $genericDatas = new GenericDatasEvent();
     $genericDatas->setDatas($resource);
     $this->eventDispatcher->dispatch('formalibre_delete_event_from_resource', 'GenericDatas', ['datas' => $genericDatas]);
 }
Beispiel #3
0
 /**
  * @DI\Observe("claroline_resources_delete")
  *
  * @param GenericDatasEvent $event
  */
 public function onResourcesDelete(GenericDatasEvent $event)
 {
     $resources = $event->getDatas();
     $ids = array();
     foreach ($resources as $resource) {
         $ids[] = $resource->getId();
     }
     $this->tagManager->removeTaggedObjectsByClassAndIds('Claroline\\CoreBundle\\Entity\\Resource\\ResourceNode', $ids);
 }
Beispiel #4
0
 /**
  * @DI\Observe("formalibre_request_nb_remaining_credits")
  *
  * @param GenericDatasEvent $event
  */
 public function onNbRemainingCreditsRequest(GenericDatasEvent $event)
 {
     $user = $event->getDatas();
     $nbCredits = $this->creditManager->getNbRemainingCredits($user);
     $event->setResponse($nbCredits);
 }