1
0
mirror of synced 2025-01-30 20:11:49 +03:00

[DDC-551] Fixed CS, comments by @stof

This commit is contained in:
Alexander 2011-12-05 23:00:52 +01:00
parent f4663f4512
commit efe7a01482
9 changed files with 50 additions and 48 deletions

View File

@ -814,7 +814,7 @@ class EntityManager implements ObjectManager
/**
* Checks whether the state of the filter collection is clean.
*
* @return boolean True, iff the filter collection is clean.
* @return boolean True, if the filter collection is clean.
*/
public function isFiltersStateClean()
{
@ -825,7 +825,7 @@ class EntityManager implements ObjectManager
/**
* Checks whether the Entity Manager has filters.
*
* @return True, iff the EM has a filter collection.
* @return True, if the EM has a filter collection.
*/
public function hasFilters()
{

View File

@ -904,7 +904,10 @@ class BasicEntityPersister
$alias = $this->_getSQLTableAlias($this->_class->name);
if ('' !== $filterSql = $this->generateFilterConditionSQL($this->_class, $alias)) {
if($conditionSql) $conditionSql .= ' AND ';
if ($conditionSql) {
$conditionSql .= ' AND ';
}
$conditionSql .= $filterSql;
}

View File

@ -385,7 +385,10 @@ class JoinedSubclassPersister extends AbstractEntityInheritancePersister
// If the current class in the root entity, add the filters
if ($this->_class->name === $this->_class->rootEntityName) {
if ('' !== $filterSql = $this->generateFilterConditionSQL($this->_class, $baseTableAlias)) {
if($conditionSql) $conditionSql .= ' AND ';
if ($conditionSql) {
$conditionSql .= ' AND ';
}
$conditionSql .= $filterSql;
}
}

View File

@ -122,7 +122,7 @@ class OneToManyPersister extends AbstractCollectionPersister
}
foreach ($this->_em->getFilters()->getEnabledFilters() as $filter) {
if("" !== $filterExpr = $filter->addFilterConstraint($targetClass, 't')) {
if ('' !== $filterExpr = $filter->addFilterConstraint($targetClass, 't')) {
$whereClauses[] = '(' . $filterExpr . ')';
}
}

View File

@ -49,7 +49,6 @@ abstract class SQLFilter
* Constructs the SQLFilter object.
*
* @param EntityManager $em The EM
* @final
*/
final public function __construct(EntityManager $em)
{
@ -63,7 +62,6 @@ abstract class SQLFilter
* @param string $value Value of the parameter.
* @param string $type Type of the parameter.
*
* @final
* @return SQLFilter The current SQL filter.
*/
final public function setParameter($name, $value, $type)
@ -88,7 +86,6 @@ abstract class SQLFilter
*
* @param string $name Name of the parameter.
*
* @final
* @return string The SQL escaped parameter to use in a query.
*/
final public function getParameter($name)
@ -103,8 +100,7 @@ abstract class SQLFilter
/**
* Returns as string representation of the SQLFilter parameters (the state).
*
* @final
* @return string String representation of the the SQLFilter.
* @return string String representation of the SQLFilter.
*/
final public function __toString()
{

View File

@ -367,7 +367,7 @@ class SqlWalker implements TreeWalker
if ($this->_em->hasFilters()) {
foreach ($this->_em->getFilters()->getEnabledFilters() as $filter) {
if("" !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) {
if ('' !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) {
$filterClauses[] = '(' . $filterExpr . ')';
}
}
@ -827,9 +827,8 @@ class SqlWalker implements TreeWalker
}
// Apply the filters
if("" !== $filterExpr = $this->generateFilterConditionSQL($targetClass, $targetTableAlias)) {
if ( ! $first) $sql .= ' AND '; else $first = false;
$sql .= $filterExpr;
if ('' !== $filterExpr = $this->generateFilterConditionSQL($targetClass, $targetTableAlias)) {
$sql .= ' AND ' . $filterExpr;
}
} else if ($assoc['type'] == ClassMetadata::MANY_TO_MANY) {
// Join relation table
@ -896,9 +895,8 @@ class SqlWalker implements TreeWalker
}
// Apply the filters
if("" !== $filterExpr = $this->generateFilterConditionSQL($targetClass, $targetTableAlias)) {
if ( ! $first) $sql .= ' AND '; else $first = false;
$sql .= $filterExpr;
if ('' !== $filterExpr = $this->generateFilterConditionSQL($targetClass, $targetTableAlias)) {
$sql .= ' AND ' . $filterExpr;
}
}
@ -1508,13 +1506,15 @@ class SqlWalker implements TreeWalker
$class = $this->_queryComponents[$dqlAlias]['metadata'];
$tableAlias = $this->getSQLTableAlias($class->table['name'], $dqlAlias);
if("" !== $filterExpr = $this->generateFilterConditionSQL($class, $tableAlias)) {
if ('' !== $filterExpr = $this->generateFilterConditionSQL($class, $tableAlias)) {
$filterClauses[] = $filterExpr;
}
}
if (count($filterClauses)) {
if($condSql) $condSql .= ' AND ';
if ($condSql) {
$condSql .= ' AND ';
}
$condSql .= implode(' AND ', $filterClauses);
}