Esempio n. 1
0
 /**
  * Handles the given exception
  *
  * @param \Exception $exception The exception object
  * @return void
  */
 public function handleException(\Exception $exception)
 {
     if (is_object($this->systemLogger)) {
         $this->systemLogger->logException($exception);
     }
     switch (PHP_SAPI) {
         case 'cli':
             $this->echoExceptionCli($exception);
             break;
         default:
             $this->echoExceptionWeb($exception);
     }
 }
Esempio n. 2
0
 /**
  * Returns the query result count
  *
  * @return integer The query result count
  * @throws \TYPO3\FLOW3\Persistence\Doctrine\DatabaseConnectionException
  * @api
  */
 public function count()
 {
     try {
         $originalQuery = $this->queryBuilder->getQuery();
         $dqlQuery = clone $originalQuery;
         $dqlQuery->setParameters($originalQuery->getParameters());
         $dqlQuery->setHint(\Doctrine\ORM\Query::HINT_CUSTOM_TREE_WALKERS, array('TYPO3\\FLOW3\\Persistence\\Doctrine\\CountWalker'));
         return (int) $dqlQuery->getSingleScalarResult();
     } catch (\Doctrine\ORM\ORMException $ormException) {
         $this->systemLogger->logException($ormException);
         return 0;
     } catch (\PDOException $pdoException) {
         throw new DatabaseConnectionException($pdoException->getMessage(), $pdoException->getCode());
     }
 }