/** * 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(); } } }
/** * 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); } }