mirror of
https://github.com/doctrine/orm.git
synced 2026-04-22 22:18:04 +02:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 810a7baf81 | |||
| 56ebf4bea9 | |||
| ff8fdbf5a3 | |||
| 22603815af | |||
| 3d65f01fe1 | |||
| 02f649e0c8 |
@@ -525,7 +525,7 @@ abstract class AbstractQuery
|
||||
*/
|
||||
public function setResultCacheProfile(QueryCacheProfile $profile = null)
|
||||
{
|
||||
if ( ! $profile->getResultCacheDriver()) {
|
||||
if ($profile !== null && ! $profile->getResultCacheDriver()) {
|
||||
$resultCacheDriver = $this->_em->getConfiguration()->getResultCacheImpl();
|
||||
$profile = $profile->setResultCacheDriver($resultCacheDriver);
|
||||
}
|
||||
|
||||
@@ -897,15 +897,17 @@ class SqlWalker implements TreeWalker
|
||||
$this->query->getHint(Query::HINT_LOCK_MODE)
|
||||
);
|
||||
|
||||
if ($class->isInheritanceTypeJoined()) {
|
||||
if ($buildNestedJoins) {
|
||||
$sql = '(' . $sql . $this->_generateClassTableInheritanceJoins($class, $dqlAlias) . ')';
|
||||
} else {
|
||||
$sql .= $this->_generateClassTableInheritanceJoins($class, $dqlAlias);
|
||||
}
|
||||
if ( ! $class->isInheritanceTypeJoined()) {
|
||||
return $sql;
|
||||
}
|
||||
|
||||
return $sql;
|
||||
$classTableInheritanceJoins = $this->_generateClassTableInheritanceJoins($class, $dqlAlias);
|
||||
|
||||
if ( ! $buildNestedJoins) {
|
||||
return $sql . $classTableInheritanceJoins;
|
||||
}
|
||||
|
||||
return $classTableInheritanceJoins === '' ? $sql : '(' . $sql . $classTableInheritanceJoins . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ class Version
|
||||
/**
|
||||
* Current Doctrine Version
|
||||
*/
|
||||
const VERSION = '2.5.13';
|
||||
const VERSION = '2.5.14';
|
||||
|
||||
/**
|
||||
* Compares a Doctrine version with the current one.
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Doctrine\Tests\ORM\Query;
|
||||
use Doctrine\Common\Cache\ArrayCache;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
use Doctrine\DBAL\Cache\QueryCacheProfile;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\Query\Parameter;
|
||||
|
||||
@@ -259,4 +260,18 @@ class QueryTest extends \Doctrine\Tests\OrmTestCase
|
||||
self::assertSame(3, $query->getParameter('0')->getValue());
|
||||
self::assertSame('Doctrine', $query->getParameter('name')->getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group 6748
|
||||
*/
|
||||
public function testResultCacheProfileCanBeRemovedViaSetter()
|
||||
{
|
||||
$this->_em->getConfiguration()->setResultCacheImpl(new ArrayCache());
|
||||
|
||||
$query = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u');
|
||||
$query->useResultCache(true);
|
||||
$query->setResultCacheProfile();
|
||||
|
||||
self::assertAttributeSame(null, '_queryCacheProfile', $query);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +160,11 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
||||
'SELECT e FROM Doctrine\Tests\Models\Company\CompanyEmployee e LEFT JOIN Doctrine\Tests\Models\Company\CompanyManager m WITH e.id = m.id',
|
||||
'SELECT c0_.id AS id_0, c0_.name AS name_1, c1_.salary AS salary_2, c1_.department AS department_3, c1_.startDate AS startDate_4, c0_.discr AS discr_5 FROM company_employees c1_ INNER JOIN company_persons c0_ ON c1_.id = c0_.id LEFT JOIN (company_managers c2_ INNER JOIN company_employees c4_ ON c2_.id = c4_.id INNER JOIN company_persons c3_ ON c2_.id = c3_.id) ON (c0_.id = c3_.id)'
|
||||
);
|
||||
|
||||
$this->assertSqlGeneration(
|
||||
'SELECT c FROM Doctrine\Tests\Models\Company\CompanyContract c JOIN c.salesPerson s LEFT JOIN Doctrine\Tests\Models\Company\CompanyEvent e WITH s.id = e.id',
|
||||
'SELECT c0_.id AS id_0, c0_.completed AS completed_1, c0_.fixPrice AS fixPrice_2, c0_.hoursWorked AS hoursWorked_3, c0_.pricePerHour AS pricePerHour_4, c0_.maxPrice AS maxPrice_5, c0_.discr AS discr_6 FROM company_contracts c0_ INNER JOIN company_employees c1_ ON c0_.salesPerson_id = c1_.id LEFT JOIN company_persons c2_ ON c1_.id = c2_.id LEFT JOIN company_events c3_ ON (c2_.id = c3_.id) WHERE c0_.discr IN (\'fix\', \'flexible\', \'flexultra\')'
|
||||
);
|
||||
}
|
||||
|
||||
public function testSupportsSelectWithCollectionAssociationJoin()
|
||||
|
||||
Reference in New Issue
Block a user