1
0
mirror of synced 2025-02-07 07:49:27 +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. * 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() public function isFiltersStateClean()
{ {
@ -825,7 +825,7 @@ class EntityManager implements ObjectManager
/** /**
* Checks whether the Entity Manager has filters. * 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() public function hasFilters()
{ {

View File

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

View File

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

View File

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

View File

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

View File

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