first commit
This commit is contained in:
40
bundles/KupShop/DevelopmentBundle/Query/QueryBuilder.php
Normal file
40
bundles/KupShop/DevelopmentBundle/Query/QueryBuilder.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace KupShop\DevelopmentBundle\Query;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
|
||||
class QueryBuilder extends \Query\QueryBuilder
|
||||
{
|
||||
protected static $qb = [];
|
||||
|
||||
public function __construct(Connection $connection)
|
||||
{
|
||||
self::$qb[] = $this;
|
||||
|
||||
parent::__construct($connection);
|
||||
}
|
||||
|
||||
public static function getPendingQueryBuilders()
|
||||
{
|
||||
return self::$qb;
|
||||
}
|
||||
|
||||
public function getSQL()
|
||||
{
|
||||
$this->markExecuted();
|
||||
|
||||
return parent::getSQL();
|
||||
}
|
||||
|
||||
protected function markExecuted()
|
||||
{
|
||||
$found = array_search($this, self::$qb);
|
||||
|
||||
if ($found === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
unset(self::$qb[$found]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user