public function attachServices()
 {
     if (!$this->isEnabled()) {
         return;
     }
     $services = array_keys($this->di->getServices());
     foreach ($services as $name) {
         if (stripos($name, 'cache') !== false) {
             $this->attachCache($name);
         }
         if (stripos($name, 'db') === 0 || strtolower(substr($name, -2)) == 'db') {
             $this->attachDb($name);
         }
     }
     if ($this->di->has('view')) {
         $this->attachView($this->di['view']);
     }
     if ($this->shouldCollect('mail', true) && $this->di->has('mailer')) {
         $this->attachMailer($this->di['mailer']);
     }
     if ($this->shouldCollect('doctrine', false) && !$this->hasCollector('doctrine') && !$this->hasCollector('pdo')) {
         $debugStack = new \Doctrine\DBAL\Logging\DebugStack();
         $entityManager = $this->di['entityManager'];
         $entityManager->getConnection()->getConfiguration()->setSQLLogger($debugStack);
         $this->addCollector(new DoctrineCollector($debugStack));
     }
 }
 public function attachServices()
 {
     if (!$this->isEnabled()) {
         return;
     }
     $services = array_keys($this->di->getServices());
     foreach ($services as $name) {
         if (stripos($name, 'cache') !== false) {
             $this->attachCache($name);
         }
         if (stripos($name, 'db') === 0 || strtolower(substr($name, -2)) == 'db') {
             $this->attachDb($name);
         }
     }
     if ($this->di->has('view')) {
         $this->attachView($this->di['view']);
     }
     if ($this->shouldCollect('mail', true) && $this->di->has('mailer')) {
         $this->attachMailer($this->di['mailer']);
     }
 }