[DDC-551] Various refactorings
This commit is contained in:
parent
04635ad4ff
commit
e8d30068e2
@ -72,6 +72,7 @@ use PDO,
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Giorgio Sironi <piccoloprincipeazzurro@gmail.com>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Alexander <iam.asm89@gmail.com>
|
||||
* @since 2.0
|
||||
*/
|
||||
class BasicEntityPersister
|
||||
@ -1592,16 +1593,14 @@ class BasicEntityPersister
|
||||
*/
|
||||
protected function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias)
|
||||
{
|
||||
$filterSql = '';
|
||||
$filterClauses = array();
|
||||
|
||||
$first = true;
|
||||
foreach($this->_em->getFilters()->getEnabledFilters() as $filter) {
|
||||
if('' !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) {
|
||||
if (!$first) $filterSql .= ' AND '; else $first = false;
|
||||
$filterSql .= '(' . $filterExpr . ')';
|
||||
$filterClauses[] = '(' . $filterExpr . ')';
|
||||
}
|
||||
}
|
||||
|
||||
return $filterSql;
|
||||
return implode(' AND ', $filterClauses);
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ use Doctrine\ORM\ORMException,
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Alexander <iam.asm89@gmail.com>
|
||||
* @since 2.0
|
||||
* @see http://martinfowler.com/eaaCatalog/classTableInheritance.html
|
||||
*/
|
||||
|
@ -30,6 +30,7 @@ use Doctrine\ORM\Mapping\ClassMetadata,
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Alexander <iam.asm89@gmail.com>
|
||||
* @since 2.0
|
||||
*/
|
||||
class ManyToManyPersister extends AbstractCollectionPersister
|
||||
@ -379,16 +380,14 @@ class ManyToManyPersister extends AbstractCollectionPersister
|
||||
*/
|
||||
protected function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias)
|
||||
{
|
||||
$filterSql = '';
|
||||
$filterClauses = array();
|
||||
|
||||
$first = true;
|
||||
foreach($this->_em->getFilters()->getEnabledFilters() as $filter) {
|
||||
if('' !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) {
|
||||
if($first) $first = false; else $filterSql .= ' AND ';
|
||||
$filterSql .= '(' . $filterExpr . ')';
|
||||
$filterClauses[] = '(' . $filterExpr . ')';
|
||||
}
|
||||
}
|
||||
|
||||
return $filterSql;
|
||||
return implode(' AND ', $filterClauses);
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ use Doctrine\ORM\PersistentCollection,
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Alexander <iam.asm89@gmail.com>
|
||||
* @since 2.0
|
||||
*/
|
||||
class OneToManyPersister extends AbstractCollectionPersister
|
||||
|
@ -27,6 +27,7 @@ use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Alexander <iam.asm89@gmail.com>
|
||||
* @since 2.0
|
||||
* @link http://martinfowler.com/eaaCatalog/singleTableInheritance.html
|
||||
*/
|
||||
|
@ -33,6 +33,7 @@ use Doctrine\DBAL\LockMode,
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Alexander <iam.asm89@gmail.com>
|
||||
* @since 2.0
|
||||
* @todo Rename: SQLWalker
|
||||
*/
|
||||
@ -362,19 +363,17 @@ class SqlWalker implements TreeWalker
|
||||
*/
|
||||
private function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias)
|
||||
{
|
||||
$filterSql = '';
|
||||
$filterClauses = array();
|
||||
|
||||
if($this->_em->hasFilters()) {
|
||||
$first = true;
|
||||
foreach($this->_em->getFilters()->getEnabledFilters() as $filter) {
|
||||
if("" !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) {
|
||||
if ( ! $first) $filterSql .= ' AND '; else $first = false;
|
||||
$filterSql .= '(' . $filterExpr . ')';
|
||||
$filterClauses[] = '(' . $filterExpr . ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $filterSql;
|
||||
return implode(' AND ', $filterClauses);
|
||||
}
|
||||
/**
|
||||
* Walks down a SelectStatement AST node, thereby generating the appropriate SQL.
|
||||
|
Loading…
Reference in New Issue
Block a user