Compare commits

..

6 Commits

Author SHA1 Message Date
Luís Cobucci 810a7baf81 Preparing v2.5.14 release 2017-12-17 03:57:51 +01:00
Luís Cobucci 56ebf4bea9 Merge branch 'backport/patch1' into 2.5
Backporting https://github.com/doctrine/doctrine2/pull/6748
2017-12-17 03:27:21 +01:00
Konstantin Kuklin ff8fdbf5a3 Fix insufficient variable check
To ensure that `AbstractQuery#setResultCacheProfile()` doesn't raise
errors when being called with `null`.
2017-12-17 03:27:10 +01:00
Luís Cobucci 22603815af Merge branch 'backport/bugfix/inheritance-joins' into 2.5
Backporting https://github.com/doctrine/doctrine2/pull/6812
2017-12-17 01:40:12 +01:00
Maximilian Ruta 3d65f01fe1 Fix syntax error when join with discriminator 2017-12-17 01:33:15 +01:00
Luís Cobucci 02f649e0c8 Bumping development version to v2.5.14-DEV 2017-11-28 00:36:27 +01:00
5 changed files with 31 additions and 9 deletions
+1 -1
View File
@@ -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);
}
+9 -7
View File
@@ -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 . ')';
}
/**
+1 -1
View File
@@ -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()