[2.0][DDC-274] Moved Sql to SQL loggers. Also implemented some todos.
This commit is contained in:
parent
c4a9ce1cd3
commit
b0963d91c7
@ -59,10 +59,9 @@ class Configuration
|
|||||||
/**
|
/**
|
||||||
* Sets the SQL logger to use. Defaults to NULL which means SQL logging is disabled.
|
* Sets the SQL logger to use. Defaults to NULL which means SQL logging is disabled.
|
||||||
*
|
*
|
||||||
* @param SqlLogger $logger
|
* @param SQLLogger $logger
|
||||||
* @todo Rename to setSQLLogger()
|
|
||||||
*/
|
*/
|
||||||
public function setSqlLogger($logger)
|
public function setSQLLogger($logger)
|
||||||
{
|
{
|
||||||
$this->_attributes['sqlLogger'] = $logger;
|
$this->_attributes['sqlLogger'] = $logger;
|
||||||
}
|
}
|
||||||
@ -70,10 +69,9 @@ class Configuration
|
|||||||
/**
|
/**
|
||||||
* Gets the SQL logger that is used.
|
* Gets the SQL logger that is used.
|
||||||
*
|
*
|
||||||
* @return SqlLogger
|
* @return SQLLogger
|
||||||
* @todo Rename to getSQLLogger()
|
|
||||||
*/
|
*/
|
||||||
public function getSqlLogger()
|
public function getSQLLogger()
|
||||||
{
|
{
|
||||||
return $this->_attributes['sqlLogger'];
|
return $this->_attributes['sqlLogger'];
|
||||||
}
|
}
|
||||||
|
@ -21,13 +21,30 @@
|
|||||||
|
|
||||||
namespace Doctrine\DBAL\Logging;
|
namespace Doctrine\DBAL\Logging;
|
||||||
|
|
||||||
class DebugStack implements SqlLogger
|
/**
|
||||||
|
* Includes executed SQLs in a Debug Stack
|
||||||
|
*
|
||||||
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
|
* @link www.doctrine-project.org
|
||||||
|
* @since 2.0
|
||||||
|
* @version $Revision$
|
||||||
|
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||||
|
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||||
|
* @author Jonathan Wage <jonwage@gmail.com>
|
||||||
|
* @author Roman Borschel <roman@code-factory.org>
|
||||||
|
*/
|
||||||
|
class DebugStack implements SQLLogger
|
||||||
{
|
{
|
||||||
|
/** @var array $queries Executed SQL queries. */
|
||||||
public $queries = array();
|
public $queries = array();
|
||||||
|
|
||||||
|
/** @var boolean $enabled If Debug Stack is enabled (log queries) or not. */
|
||||||
public $enabled = true;
|
public $enabled = true;
|
||||||
|
|
||||||
public function logSql($sql, array $params = null)
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function logSQL($sql, array $params = null)
|
||||||
{
|
{
|
||||||
if ($this->enabled) {
|
if ($this->enabled) {
|
||||||
$this->queries[] = array('sql' => $sql, 'params' => $params);
|
$this->queries[] = array('sql' => $sql, 'params' => $params);
|
||||||
|
@ -1,21 +1,49 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This software consists of voluntary contributions made by many individuals
|
||||||
|
* and is licensed under the LGPL. For more information, see
|
||||||
|
* <http://www.doctrine-project.org>.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Doctrine\DBAL\Logging;
|
namespace Doctrine\DBAL\Logging;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A SQL logger that logs to the standard output using echo/var_dump.
|
* A SQL logger that logs to the standard output using echo/var_dump.
|
||||||
*
|
*
|
||||||
* @author Roman Borschel <roman@code-factory.org>
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @since 2.0
|
* @link www.doctrine-project.org
|
||||||
* @todo Rename: EchoSQLLogger
|
* @since 2.0
|
||||||
|
* @version $Revision$
|
||||||
|
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||||
|
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||||
|
* @author Jonathan Wage <jonwage@gmail.com>
|
||||||
|
* @author Roman Borschel <roman@code-factory.org>
|
||||||
*/
|
*/
|
||||||
class EchoSqlLogger implements SqlLogger
|
class EchoSQLLogger implements SQLLogger
|
||||||
{
|
{
|
||||||
public function logSql($sql, array $params = null)
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function logSQL($sql, array $params = null)
|
||||||
{
|
{
|
||||||
echo $sql . PHP_EOL;
|
echo $sql . PHP_EOL;
|
||||||
if ($params) {
|
|
||||||
var_dump($params);
|
if ($params) {
|
||||||
|
var_dump($params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,15 +1,45 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* This software consists of voluntary contributions made by many individuals
|
||||||
|
* and is licensed under the LGPL. For more information, see
|
||||||
|
* <http://www.doctrine-project.org>.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Doctrine\DBAL\Logging;
|
namespace Doctrine\DBAL\Logging;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for SQL loggers.
|
* Interface for SQL loggers.
|
||||||
*
|
*
|
||||||
* @author Roman Borschel <roman@code-factory.org>
|
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||||
* @since 2.0
|
* @link www.doctrine-project.org
|
||||||
* @todo Rename: SQLLogger
|
* @since 2.0
|
||||||
|
* @version $Revision$
|
||||||
|
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||||
|
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||||
|
* @author Jonathan Wage <jonwage@gmail.com>
|
||||||
|
* @author Roman Borschel <roman@code-factory.org>
|
||||||
*/
|
*/
|
||||||
interface SqlLogger
|
interface SQLLogger
|
||||||
{
|
{
|
||||||
function logSql($sql, array $params = null);
|
/**
|
||||||
|
* Logs a SQL statement somewhere.
|
||||||
|
*
|
||||||
|
* @param string $sql The SQL to be executed.
|
||||||
|
* @param array $params The SQL parameters.
|
||||||
|
*/
|
||||||
|
function logSQL($sql, array $params = null);
|
||||||
}
|
}
|
@ -578,7 +578,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->_em->persist($article);
|
$this->_em->persist($article);
|
||||||
$this->_em->persist($user);
|
$this->_em->persist($user);
|
||||||
|
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
|
|
||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
$this->_em->clear();
|
$this->_em->clear();
|
||||||
@ -589,14 +589,14 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->assertEquals(1, count($user2->articles));
|
$this->assertEquals(1, count($user2->articles));
|
||||||
$this->assertTrue($user2->address instanceof CmsAddress);
|
$this->assertTrue($user2->address instanceof CmsAddress);
|
||||||
|
|
||||||
$oldLogger = $this->_em->getConnection()->getConfiguration()->getSqlLogger();
|
$oldLogger = $this->_em->getConnection()->getConfiguration()->getSQLLogger();
|
||||||
$debugStack = new \Doctrine\DBAL\Logging\DebugStack;
|
$debugStack = new \Doctrine\DBAL\Logging\DebugStack;
|
||||||
$this->_em->getConnection()->getConfiguration()->setSqlLogger($debugStack);
|
$this->_em->getConnection()->getConfiguration()->setSQLLogger($debugStack);
|
||||||
|
|
||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
$this->assertEquals(0, count($debugStack->queries));
|
$this->assertEquals(0, count($debugStack->queries));
|
||||||
|
|
||||||
$this->_em->getConnection()->getConfiguration()->setSqlLogger($oldLogger);
|
$this->_em->getConnection()->getConfiguration()->setSQLLogger($oldLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRemoveEntityByReference()
|
public function testRemoveEntityByReference()
|
||||||
@ -606,7 +606,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$user->username = 'gblanco';
|
$user->username = 'gblanco';
|
||||||
$user->status = 'developer';
|
$user->status = 'developer';
|
||||||
|
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
|
|
||||||
$this->_em->persist($user);
|
$this->_em->persist($user);
|
||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
@ -619,7 +619,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
|
|
||||||
$this->assertEquals(0, $this->_em->getConnection()->fetchColumn("select count(*) from cms_users"));
|
$this->assertEquals(0, $this->_em->getConnection()->fetchColumn("select count(*) from cms_users"));
|
||||||
|
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(null);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -643,7 +643,7 @@ class BasicFunctionalTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
$this->_em->clear();
|
$this->_em->clear();
|
||||||
|
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
|
|
||||||
$userRef = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $user->getId());
|
$userRef = $this->_em->getReference('Doctrine\Tests\Models\CMS\CmsUser', $user->getId());
|
||||||
$address2 = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsAddress a where a.user = :user')
|
$address2 = $this->_em->createQuery('select a from Doctrine\Tests\Models\CMS\CmsAddress a where a.user = :user')
|
||||||
|
@ -23,7 +23,7 @@ class ClassTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
$this->useModelSet('company');
|
$this->useModelSet('company');
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCRUD()
|
public function testCRUD()
|
||||||
|
@ -23,7 +23,7 @@ class FlushEventTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
|
|
||||||
public function testPersistNewEntitiesOnPreFlush()
|
public function testPersistNewEntitiesOnPreFlush()
|
||||||
{
|
{
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
$this->_em->getEventManager()->addEventListener(Events::onFlush, new OnFlushListener);
|
$this->_em->getEventManager()->addEventListener(Events::onFlush, new OnFlushListener);
|
||||||
|
|
||||||
$user = new CmsUser;
|
$user = new CmsUser;
|
||||||
|
@ -87,7 +87,7 @@ class LifecycleCallbackTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
*/
|
*/
|
||||||
public function testCascadedEntitiesCallsPrePersist()
|
public function testCascadedEntitiesCallsPrePersist()
|
||||||
{
|
{
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
|
|
||||||
$e1 = new LifecycleCallbackTestEntity;
|
$e1 = new LifecycleCallbackTestEntity;
|
||||||
$e2 = new LifecycleCallbackTestEntity;
|
$e2 = new LifecycleCallbackTestEntity;
|
||||||
|
@ -68,7 +68,7 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati
|
|||||||
|
|
||||||
public function testEagerLoadFromInverseSideAndLazyLoadFromOwningSide()
|
public function testEagerLoadFromInverseSideAndLazyLoadFromOwningSide()
|
||||||
{
|
{
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
$this->_createLoadingFixture();
|
$this->_createLoadingFixture();
|
||||||
$categories = $this->_findCategories();
|
$categories = $this->_findCategories();
|
||||||
$this->assertLazyLoadFromOwningSide($categories);
|
$this->assertLazyLoadFromOwningSide($categories);
|
||||||
@ -76,7 +76,7 @@ class ManyToManyBidirectionalAssociationTest extends AbstractManyToManyAssociati
|
|||||||
|
|
||||||
public function testEagerLoadFromOwningSideAndLazyLoadFromInverseSide()
|
public function testEagerLoadFromOwningSideAndLazyLoadFromInverseSide()
|
||||||
{
|
{
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
$this->_createLoadingFixture();
|
$this->_createLoadingFixture();
|
||||||
$products = $this->_findProducts();
|
$products = $this->_findProducts();
|
||||||
$this->assertLazyLoadFromInverseSide($products);
|
$this->assertLazyLoadFromInverseSide($products);
|
||||||
|
@ -123,7 +123,7 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona
|
|||||||
|
|
||||||
public function testLazyLoadsObjectsOnTheInverseSide2()
|
public function testLazyLoadsObjectsOnTheInverseSide2()
|
||||||
{
|
{
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
$this->_createFixture();
|
$this->_createFixture();
|
||||||
|
|
||||||
$query = $this->_em->createQuery('select f,p from Doctrine\Tests\Models\ECommerce\ECommerceFeature f join f.product p');
|
$query = $this->_em->createQuery('select f,p from Doctrine\Tests\Models\ECommerce\ECommerceFeature f join f.product p');
|
||||||
@ -141,7 +141,7 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona
|
|||||||
//$this->assertTrue($product->getFeatures()->contains($features[0]));
|
//$this->assertTrue($product->getFeatures()->contains($features[0]));
|
||||||
//$this->assertTrue($product->getFeatures()->contains($features[1]));
|
//$this->assertTrue($product->getFeatures()->contains($features[1]));
|
||||||
|
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(null);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testJoinFromOwningSide()
|
public function testJoinFromOwningSide()
|
||||||
|
@ -167,7 +167,7 @@ class SingleTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$parentRelated->setParent($child2);
|
$parentRelated->setParent($child2);
|
||||||
$this->_em->persist($parentRelated);
|
$this->_em->persist($parentRelated);
|
||||||
|
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
|
|
||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
$this->_em->clear();
|
$this->_em->clear();
|
||||||
|
@ -9,7 +9,7 @@ class DDC144Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
|
|
||||||
$this->_schemaTool->createSchema(array(
|
$this->_schemaTool->createSchema(array(
|
||||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC144FlowElement'),
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC144FlowElement'),
|
||||||
|
@ -18,7 +18,7 @@ class DDC168Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
*/
|
*/
|
||||||
public function testJoinedSubclassPersisterRequiresSpecificOrderOfMetadataReflFieldsArray()
|
public function testJoinedSubclassPersisterRequiresSpecificOrderOfMetadataReflFieldsArray()
|
||||||
{
|
{
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
|
|
||||||
$metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\Company\CompanyEmployee');
|
$metadata = $this->_em->getClassMetadata('Doctrine\Tests\Models\Company\CompanyEmployee');
|
||||||
ksort($metadata->reflFields);
|
ksort($metadata->reflFields);
|
||||||
|
@ -17,7 +17,7 @@ class DDC211Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
|
|
||||||
public function testIssue()
|
public function testIssue()
|
||||||
{
|
{
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
|
|
||||||
$user = new DDC211User;
|
$user = new DDC211User;
|
||||||
$user->setName('John Doe');
|
$user->setName('John Doe');
|
||||||
|
@ -21,7 +21,7 @@ class DDC258Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
*/
|
*/
|
||||||
public function testIssue()
|
public function testIssue()
|
||||||
{
|
{
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
|
|
||||||
$c1 = new DDC258Class1();
|
$c1 = new DDC258Class1();
|
||||||
$c1->title = "Foo";
|
$c1->title = "Foo";
|
||||||
|
@ -9,7 +9,7 @@ class DDC345Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
$this->_schemaTool->createSchema(array(
|
$this->_schemaTool->createSchema(array(
|
||||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC345User'),
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC345User'),
|
||||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC345Group'),
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC345Group'),
|
||||||
|
@ -10,7 +10,7 @@ class DDC371Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
$this->_schemaTool->createSchema(array(
|
$this->_schemaTool->createSchema(array(
|
||||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC371Parent'),
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC371Parent'),
|
||||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC371Child')
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC371Child')
|
||||||
|
@ -8,7 +8,7 @@ class DDC422Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
$this->_schemaTool->createSchema(array(
|
$this->_schemaTool->createSchema(array(
|
||||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC422Guest'),
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC422Guest'),
|
||||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC422Customer'),
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC422Customer'),
|
||||||
|
@ -21,7 +21,7 @@ class DDC425Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
*/
|
*/
|
||||||
public function testIssue()
|
public function testIssue()
|
||||||
{
|
{
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSqlLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
|
|
||||||
$num = $this->_em->createQuery('DELETE '.__NAMESPACE__.'\DDC425Entity e WHERE e.someDatetimeField > ?1')
|
$num = $this->_em->createQuery('DELETE '.__NAMESPACE__.'\DDC425Entity e WHERE e.someDatetimeField > ?1')
|
||||||
->setParameter(1, new DateTime, Type::DATETIME)
|
->setParameter(1, new DateTime, Type::DATETIME)
|
||||||
|
@ -9,7 +9,7 @@ class DDC444Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSqlLogger);
|
//$this->_em->getConnection()->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger);
|
||||||
$this->_schemaTool->createSchema(array(
|
$this->_schemaTool->createSchema(array(
|
||||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC444User'),
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC444User'),
|
||||||
));
|
));
|
||||||
|
@ -222,7 +222,7 @@ abstract class OrmFunctionalTestCase extends OrmTestCase
|
|||||||
$config->setProxyNamespace('Doctrine\Tests\Proxies');
|
$config->setProxyNamespace('Doctrine\Tests\Proxies');
|
||||||
|
|
||||||
$conn = $this->sharedFixture['conn'];
|
$conn = $this->sharedFixture['conn'];
|
||||||
$conn->getConfiguration()->setSqlLogger($this->_sqlLoggerStack);
|
$conn->getConfiguration()->setSQLLogger($this->_sqlLoggerStack);
|
||||||
|
|
||||||
return \Doctrine\ORM\EntityManager::create($conn, $config);
|
return \Doctrine\ORM\EntityManager::create($conn, $config);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user