コード例 #1
0
 /**
  * Handles delete event for articles. Unlink article from entry and
  * unpublishes entry.
  *
  * @param  Newscoop\EventDispatcher\Events\GenericEvent $event
  */
 public function delete(GenericEvent $event)
 {
     $eventCaller = $event->getSubject();
     $arguments = $event->getArguments();
     if ($eventCaller instanceof \Article) {
         $entry = $this->em->getRepository('Newscoop\\IngestPluginBundle\\Entity\\Feed\\Entry')->findOneByArticleId($eventCaller->getArticleNumber());
         if ($entry !== null) {
             $entry->setArticleId(NULL);
             $entry->setPublished(NULL);
             $this->em->persist($entry);
             $this->em->flush();
         }
     }
 }
コード例 #2
0
 /**
  * Sends an emails with the informations about expiring
  * subscription.
  *
  * @param GenericEvent $event
  */
 public function sendSubscriptionExpirationEmail(GenericEvent $event)
 {
     $subscription = $event->getSubject();
     $this->sendValidatedNotification(Emails::SUBSCRIPTION_EXPIRATION, $subscription);
     if (!$subscription->getNotifySentLevelOne()) {
         $this->notificationsService->setSentDateTimeOnLevelOne($subscription);
     } else {
         $this->notificationsService->setSentDateTimeOnLevelTwo($subscription);
     }
 }