Merge branch 'master' of github.com:doctrine/doctrine2
This commit is contained in:
commit
73f908f25c
@ -43,11 +43,26 @@ class Composite extends Base
|
|||||||
$components = array();
|
$components = array();
|
||||||
|
|
||||||
foreach ($this->_parts as $part) {
|
foreach ($this->_parts as $part) {
|
||||||
$components[] = (is_object($part) && $part instanceof self && $part->count() > 1)
|
$components[] = $this->processQueryPart($part);
|
||||||
? $this->_preSeparator . ((string) $part) . $this->_postSeparator
|
|
||||||
: ((string) $part);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode($this->_separator, $components);
|
return implode($this->_separator, $components);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function processQueryPart($part)
|
||||||
|
{
|
||||||
|
$queryPart = (string) $part;
|
||||||
|
|
||||||
|
if (is_object($part) && $part instanceof self && $part->count() > 1) {
|
||||||
|
return $this->_preSeparator . $queryPart . $this->_postSeparator;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fixes DDC-1237: User may have added a where item containing nested expression (with "OR" or "AND")
|
||||||
|
if (mb_stripos($queryPart, ' OR ') !== false || mb_stripos($queryPart, ' AND ') !== false) {
|
||||||
|
return $this->_preSeparator . $queryPart . $this->_postSeparator;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $queryPart;
|
||||||
|
}
|
||||||
}
|
}
|
@ -36,7 +36,7 @@ class Version
|
|||||||
/**
|
/**
|
||||||
* Current Doctrine Version
|
* Current Doctrine Version
|
||||||
*/
|
*/
|
||||||
const VERSION = '2.1.0-DEV';
|
const VERSION = '2.1.0RC4-DEV';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares a Doctrine version with the current one.
|
* Compares a Doctrine version with the current one.
|
||||||
|
2
lib/vendor/doctrine-common
vendored
2
lib/vendor/doctrine-common
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 9a4add6713069fddc36b79484909c010b6c110c1
|
Subproject commit 74a2c924cd08b30785877808b1fb519b4b2e60b1
|
@ -198,6 +198,17 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
$this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid');
|
$this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testComplexAndWhere()
|
||||||
|
{
|
||||||
|
$qb = $this->_em->createQueryBuilder()
|
||||||
|
->select('u')
|
||||||
|
->from('Doctrine\Tests\Models\CMS\CmsUser', 'u')
|
||||||
|
->where('u.id = :uid OR u.id = :uid2 OR u.id = :uid3')
|
||||||
|
->andWhere('u.name = :name');
|
||||||
|
|
||||||
|
$this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE (u.id = :uid OR u.id = :uid2 OR u.id = :uid3) AND u.name = :name');
|
||||||
|
}
|
||||||
|
|
||||||
public function testAndWhere()
|
public function testAndWhere()
|
||||||
{
|
{
|
||||||
$qb = $this->_em->createQueryBuilder()
|
$qb = $this->_em->createQueryBuilder()
|
||||||
|
Loading…
Reference in New Issue
Block a user