Ejemplo n.º 1
0
 /**
  * @DI\Observe("refresh_cache")
  */
 public function refreshCache(RefreshCacheEvent $event)
 {
     try {
         $this->mailer->getTransport()->start();
         $event->addCacheParameter('is_mailer_available', true);
     } catch (\Swift_TransportException $e) {
         $event->addCacheParameter('is_mailer_available', false);
     }
 }
Ejemplo n.º 2
0
 /**
  * @DI\Observe("refresh_cache")
  *
  * @param RefreshCacheEvent $event
  */
 public function refreshCache(RefreshCacheEvent $event)
 {
     foreach (Configuration::resourceOwners() as $resourceOwner) {
         $service = str_replace(' ', '_', strtolower($resourceOwner));
         $errors = $this->validateService($service, $this->platformConfigHandler->getParameter($service . '_client_id'), $this->platformConfigHandler->getParameter($service . '_client_secret'));
         $event->addCacheParameter("is_{$service}_available", count($errors) === 0 and $this->platformConfigHandler->getParameter($service . '_client_active'));
     }
 }