Skip to content

Instantly share code, notes, and snippets.

@sthamann
Created May 29, 2013 05:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save sthamann/5668095 to your computer and use it in GitHub Desktop.
Save sthamann/5668095 to your computer and use it in GitHub Desktop.
Usage doctrine sql logger
$logger = new \Doctrine\DBAL\Logging\DebugStack();
$logger->enabled;
Shopware()->Models()->getConfiguration()->setSQLLogger($logger);
// Shopware Doctrine Queries
//get access on the customer repository
$query = $this->getRepository()->getListQuery($filter, $customerGroup, $sort, $limit, $offset);
//returns the total count of the query
$totalResult = $this->getManager()->getQueryCount($query);
//returns the customer data
$customers = $query->getArrayResult();
// Dump SQL
echo '<pre>';
\Doctrine\Common\Util\Debug::dump($logger, 5);
exit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment