1
0
mirror of synced 2024-12-13 14:56:01 +03:00

[DDC-551] Various refactorings

This commit is contained in:
Alexander 2011-12-05 22:05:42 +01:00
parent 04635ad4ff
commit e8d30068e2
6 changed files with 15 additions and 15 deletions

View File

@ -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);
}
}

View File

@ -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
*/

View File

@ -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);
}
}

View File

@ -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

View File

@ -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
*/

View File

@ -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.