如何在Flow Framework中打印查询?

时间:2015-06-18 06:23:03

标签: mysql doctrine flow-framework

我想在Flow Framework中从对象打印SQL查询。

$query = $this->createQuery();

        return $query->matching(
            $query->logicalAnd(
                $query->equals('account.accountIdentifier', trim($email)),
                $query->equals('isBlocked', 0)
            )
        )->execute();

1 个答案:

答案 0 :(得分:1)

试试这个我会打印sql / dql查询:

/** @var $query \TYPO3\Flow\Persistence\Doctrine\Query */
/** @var $doctrineQueryBuilder \Doctrine\ORM\QueryBuilder */
$doctrineQueryBuilder = \TYPO3\Flow\Reflection\ObjectAccess::getProperty($query, 'queryBuilder', TRUE);

/** @var $doctrineQuery \Doctrine\ORM\Query */
$doctrineQuery = $doctrineQueryBuilder->getQuery();

\TYPO3\Flow\var_dump($doctrineQuery->getDQL());
\TYPO3\Flow\var_dump($doctrineQuery->getSQL());