Alex Rivera | Logout

How to debug a query in extbase?

Asked 2011-02-22T07:30:34.523
17
$query = $this->createQuery();

    return $query->matching($query->like('linker', "$linkerKey=$linkerValue"))
        ->setOrderings(array('crdate' => $ordering))
        ->execute();

How can i debug such a generated query in extbase? When creating the same query again (but without the execute() ) and trying to display it with var_dump or the internal t3lib_div::debug i just receive a blank page.

Edit
Report

2 Answers

7
$query = $this->createQuery();
$result = $query->matching($query->like('linker', "$linkerKey=$linkerValue"))
   ->setOrderings(array('crdate' => $ordering))
   ->execute();

$GLOBALS['TYPO3_DB']->debugOutput = true;

return $result;
answered 2011-04-16T08:42:15.730
5

This hack to extbase is dirty, but useful:

In typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php edit the method buildQuery(array $sql) before the return statement, add:

t3lib_div::debug($statement, 'SQL Query Extbase');

Remove after use, and don't forget this will affect everything that runs on extbase, so use in dev environment only

Source: http://sancer-media.net/2011/extbase-schneller-mysql-debug.html

answered 2013-06-21T20:20:07.993

Your Answer