runDql() публичный Метод

Run DQL and return the result as-is.
public runDql ( string $dql, integer $hydrationMode = Doctrine\ORM\Query::HYDRATE_OBJECT, integer $firstResult = null, integer $maxResult = null ) : mixed
$dql string
$hydrationMode integer
$firstResult integer
$maxResult integer
Результат mixed
Пример #1
0
 /**
  * Run arbitrary DQL and display results
  *
  * Any DQL queries passed after the parameters will be executed, the results will be output:
  *
  * doctrine:dql --limit 10 'SELECT a FROM Neos\Flow\Security\Account a'
  *
  * @param integer $depth How many levels deep the result should be dumped
  * @param string $hydrationMode One of: object, array, scalar, single-scalar, simpleobject
  * @param integer $offset Offset the result by this number
  * @param integer $limit Limit the result to this number
  * @return void
  * @throws \InvalidArgumentException
  */
 public function dqlCommand($depth = 3, $hydrationMode = 'array', $offset = null, $limit = null)
 {
     if (!$this->isDatabaseConfigured()) {
         $this->outputLine('DQL query is not possible, the driver and host backend options are not set in /Configuration/Settings.yaml.');
         $this->quit(1);
     }
     $dqlStatements = $this->request->getExceedingArguments();
     $hydrationModeConstant = 'Doctrine\\ORM\\Query::HYDRATE_' . strtoupper(str_replace('-', '_', $hydrationMode));
     if (!defined($hydrationModeConstant)) {
         throw new \InvalidArgumentException('Hydration mode "' . $hydrationMode . '" does not exist. It should be either: object, array, scalar or single-scalar.');
     }
     foreach ($dqlStatements as $dql) {
         $resultSet = $this->doctrineService->runDql($dql, constant($hydrationModeConstant), $offset, $limit);
         Debug::dump($resultSet, $depth);
     }
 }