1
0
mirror of synced 2025-01-29 19:41:45 +03:00

Fix CS: AS => as in foreach loops.

This commit is contained in:
Benjamin Eberlei 2012-03-24 11:16:32 +01:00
parent 08b455b029
commit ab15528fde
18 changed files with 62 additions and 62 deletions

View File

@ -75,7 +75,7 @@ class SimpleObjectHydrator extends AbstractHydrator
return;
}
foreach ($this->_rsm->declaringClasses AS $column => $class) {
foreach ($this->_rsm->declaringClasses as $column => $class) {
$this->declaringClasses[$column] = $this->_em->getClassMetadata($class);
}
}

View File

@ -2148,7 +2148,7 @@ class ClassMetadataInfo implements ClassMetadata
if (isset($this->fieldNames[$columnName])) {
return $this->fieldNames[$columnName];
} else {
foreach ($this->associationMappings AS $assocName => $mapping) {
foreach ($this->associationMappings as $assocName => $mapping) {
if ($this->isAssociationWithSingleJoinColumn($assocName) &&
$this->associationMappings[$assocName]['joinColumns'][0]['name'] == $columnName) {

View File

@ -94,12 +94,12 @@ class DatabaseDriver implements Driver
public function setTables($entityTables, $manyToManyTables)
{
$this->tables = $this->manyToManyTables = $this->classToTableNames = array();
foreach ($entityTables AS $table) {
foreach ($entityTables as $table) {
$className = $this->getClassNameForTable($table->getName());
$this->classToTableNames[$className] = $table->getName();
$this->tables[$table->getName()] = $table;
}
foreach ($manyToManyTables AS $table) {
foreach ($manyToManyTables as $table) {
$this->manyToManyTables[$table->getName()] = $table;
}
}
@ -117,7 +117,7 @@ class DatabaseDriver implements Driver
}
$this->tables = $this->manyToManyTables = $this->classToTableNames = array();
foreach ($tables AS $tableName => $table) {
foreach ($tables as $tableName => $table) {
/* @var $table Table */
if ($this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$foreignKeys = $table->getForeignKeys();
@ -126,7 +126,7 @@ class DatabaseDriver implements Driver
}
$allForeignKeyColumns = array();
foreach ($foreignKeys AS $foreignKey) {
foreach ($foreignKeys as $foreignKey) {
$allForeignKeyColumns = array_merge($allForeignKeyColumns, $foreignKey->getLocalColumns());
}
@ -184,7 +184,7 @@ class DatabaseDriver implements Driver
}
$allForeignKeyColumns = array();
foreach ($foreignKeys AS $foreignKey) {
foreach ($foreignKeys as $foreignKey) {
$allForeignKeyColumns = array_merge($allForeignKeyColumns, $foreignKey->getLocalColumns());
}
@ -232,13 +232,13 @@ class DatabaseDriver implements Driver
$metadata->mapField($fieldMapping);
}
foreach ($this->manyToManyTables AS $manyTable) {
foreach ($manyTable->getForeignKeys() AS $foreignKey) {
foreach ($this->manyToManyTables as $manyTable) {
foreach ($manyTable->getForeignKeys() as $foreignKey) {
// foreign key maps to the table of the current entity, many to many association probably exists
if (strtolower($tableName) == strtolower($foreignKey->getForeignTableName())) {
$myFk = $foreignKey;
$otherFk = null;
foreach ($manyTable->getForeignKeys() AS $foreignKey) {
foreach ($manyTable->getForeignKeys() as $foreignKey) {
if ($foreignKey != $myFk) {
$otherFk = $foreignKey;
break;

View File

@ -121,13 +121,13 @@ class DriverChain implements Driver
{
$classNames = array();
$driverClasses = array();
foreach ($this->drivers AS $namespace => $driver) {
foreach ($this->drivers as $namespace => $driver) {
$oid = spl_object_hash($driver);
if (!isset($driverClasses[$oid])) {
$driverClasses[$oid] = $driver->getAllClassNames();
}
foreach ($driverClasses[$oid] AS $className) {
foreach ($driverClasses[$oid] as $className) {
if (strpos($className, $namespace) === 0) {
$classNames[$className] = true;
}
@ -146,7 +146,7 @@ class DriverChain implements Driver
*/
public function isTransient($className)
{
foreach ($this->drivers AS $namespace => $driver) {
foreach ($this->drivers as $namespace => $driver) {
if (strpos($className, $namespace) === 0) {
return $driver->isTransient($className);
}
@ -159,4 +159,4 @@ class DriverChain implements Driver
// class isTransient, i.e. not an entity or mapped superclass
return true;
}
}
}

View File

@ -111,7 +111,7 @@ class XmlDriver extends AbstractFileDriver
// Evaluate <discriminator-map...>
if (isset($xmlRoot->{'discriminator-map'})) {
$map = array();
foreach ($xmlRoot->{'discriminator-map'}->{'discriminator-mapping'} AS $discrMapElement) {
foreach ($xmlRoot->{'discriminator-map'}->{'discriminator-mapping'} as $discrMapElement) {
$map[(string)$discrMapElement['value']] = (string)$discrMapElement['class'];
}
$metadata->setDiscriminatorMap($map);
@ -339,7 +339,7 @@ class XmlDriver extends AbstractFileDriver
if (isset($oneToManyElement->{'order-by'})) {
$orderBy = array();
foreach ($oneToManyElement->{'order-by'}->{'order-by-field'} AS $orderByField) {
foreach ($oneToManyElement->{'order-by'}->{'order-by-field'} as $orderByField) {
$orderBy[(string)$orderByField['name']] = (string)$orderByField['direction'];
}
$mapping['orderBy'] = $orderBy;
@ -444,7 +444,7 @@ class XmlDriver extends AbstractFileDriver
if (isset($manyToManyElement->{'order-by'})) {
$orderBy = array();
foreach ($manyToManyElement->{'order-by'}->{'order-by-field'} AS $orderByField) {
foreach ($manyToManyElement->{'order-by'}->{'order-by-field'} as $orderByField) {
$orderBy[(string)$orderByField['name']] = (string)$orderByField['direction'];
}
$mapping['orderBy'] = $orderBy;

View File

@ -111,7 +111,7 @@ class OneToManyPersister extends AbstractCollectionPersister
$whereClauses = array();
$params = array();
foreach ($targetClass->associationMappings[$mapping['mappedBy']]['joinColumns'] AS $joinColumn) {
foreach ($targetClass->associationMappings[$mapping['mappedBy']]['joinColumns'] as $joinColumn) {
$whereClauses[] = $joinColumn['name'] . ' = ?';
$params[] = ($targetClass->containsForeignIdentifier)

View File

@ -171,7 +171,7 @@ class ResultSetMapping
{
$found = false;
foreach ($this->fieldMappings AS $columnName => $columnFieldName) {
foreach ($this->fieldMappings as $columnName => $columnFieldName) {
if ( ! ($columnFieldName === $fieldName && $this->columnOwnerMap[$columnName] === $alias)) continue;
$this->addIndexByColumn($alias, $columnName);

View File

@ -81,7 +81,7 @@ class ResultSetMappingBuilder extends ResultSetMapping
throw new \InvalidArgumentException('ResultSetMapping builder does not currently support inheritance.');
}
$platform = $this->em->getConnection()->getDatabasePlatform();
foreach ($classMetadata->getColumnNames() AS $columnName) {
foreach ($classMetadata->getColumnNames() as $columnName) {
$propertyName = $classMetadata->getFieldName($columnName);
if (isset($renamedColumns[$columnName])) {
$columnName = $renamedColumns[$columnName];
@ -92,9 +92,9 @@ class ResultSetMappingBuilder extends ResultSetMapping
}
$this->addFieldResult($alias, $columnName, $propertyName);
}
foreach ($classMetadata->associationMappings AS $associationMapping) {
foreach ($classMetadata->associationMappings as $associationMapping) {
if ($associationMapping['isOwningSide'] && $associationMapping['type'] & ClassMetadataInfo::TO_ONE) {
foreach ($associationMapping['joinColumns'] AS $joinColumn) {
foreach ($associationMapping['joinColumns'] as $joinColumn) {
$columnName = $joinColumn['name'];
$renamedColumnName = isset($renamedColumns[$columnName]) ? $renamedColumns[$columnName] : $columnName;
$renamedColumnName = $platform->getSQLResultCasing($renamedColumnName);
@ -106,4 +106,4 @@ class ResultSetMappingBuilder extends ResultSetMapping
}
}
}
}
}

View File

@ -309,13 +309,13 @@ class SqlWalker implements TreeWalker
{
$sqlParts = array();
foreach ($this->_selectedClasses AS $selectedClass) {
foreach ($this->_selectedClasses as $selectedClass) {
$dqlAlias = $selectedClass['dqlAlias'];
$qComp = $this->_queryComponents[$dqlAlias];
if ( ! isset($qComp['relation']['orderBy'])) continue;
foreach ($qComp['relation']['orderBy'] AS $fieldName => $orientation) {
foreach ($qComp['relation']['orderBy'] as $fieldName => $orientation) {
$columnName = $qComp['metadata']->getQuotedColumnName($fieldName, $this->_platform);
$tableName = ($qComp['metadata']->isInheritanceTypeJoined())
? $this->_em->getUnitOfWork()->getEntityPersister($qComp['metadata']->name)->getOwningTable($fieldName)
@ -441,7 +441,7 @@ class SqlWalker implements TreeWalker
break;
case LockMode::OPTIMISTIC:
foreach ($this->_selectedClasses AS $selectedClass) {
foreach ($this->_selectedClasses as $selectedClass) {
if ( ! $selectedClass['class']->isVersioned) {
throw \Doctrine\ORM\OptimisticLockException::lockFailed($selectedClass['class']->name);
}
@ -1420,7 +1420,7 @@ class SqlWalker implements TreeWalker
{
$sqlParts = array();
foreach ($groupByClause->groupByItems AS $groupByItem) {
foreach ($groupByClause->groupByItems as $groupByItem) {
$sqlParts[] = $this->walkGroupByItem($groupByItem);
}
@ -1448,14 +1448,14 @@ class SqlWalker implements TreeWalker
// IdentificationVariable
$sqlParts = array();
foreach ($this->_queryComponents[$groupByItem]['metadata']->fieldNames AS $field) {
foreach ($this->_queryComponents[$groupByItem]['metadata']->fieldNames as $field) {
$item = new AST\PathExpression(AST\PathExpression::TYPE_STATE_FIELD, $groupByItem, $field);
$item->type = AST\PathExpression::TYPE_STATE_FIELD;
$sqlParts[] = $this->walkPathExpression($item);
}
foreach ($this->_queryComponents[$groupByItem]['metadata']->associationMappings AS $mapping) {
foreach ($this->_queryComponents[$groupByItem]['metadata']->associationMappings as $mapping) {
if ($mapping['isOwningSide'] && $mapping['type'] & ClassMetadataInfo::TO_ONE) {
$item = new AST\PathExpression(AST\PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION, $groupByItem, $mapping['fieldName']);
$item->type = AST\PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION;

View File

@ -447,7 +447,7 @@ class QueryBuilder
if ($dqlPartName == 'join') {
$newDqlPart = array();
foreach ($dqlPart AS $k => $v) {
foreach ($dqlPart as $k => $v) {
$k = is_numeric($k) ? $this->getRootAlias() : $k;
$newDqlPart[$k] = $v;
@ -1097,9 +1097,9 @@ class QueryBuilder
*/
public function __clone()
{
foreach ($this->_dqlParts AS $part => $elements) {
foreach ($this->_dqlParts as $part => $elements) {
if (is_array($this->_dqlParts[$part])) {
foreach ($this->_dqlParts[$part] AS $idx => $element) {
foreach ($this->_dqlParts[$part] as $idx => $element) {
if (is_object($element)) {
$this->_dqlParts[$part][$idx] = clone $element;
}

View File

@ -65,9 +65,9 @@ EOT
$exit = 0;
if ($errors) {
foreach ($errors AS $className => $errorMessages) {
foreach ($errors as $className => $errorMessages) {
$output->write("<error>[Mapping] FAIL - The entity-class '" . $className . "' mapping is invalid:</error>\n");
foreach ($errorMessages AS $errorMessage) {
foreach ($errorMessages as $errorMessage) {
$output->write('* ' . $errorMessage . "\n");
}
$output->write("\n");

View File

@ -65,7 +65,7 @@ class MetadataFilter extends \FilterIterator implements \Countable
$it = $this->getInnerIterator();
$metadata = $it->current();
foreach ($this->_filter AS $filter) {
foreach ($this->_filter as $filter) {
if (strpos($metadata->name, $filter) !== false) {
return true;
}
@ -77,4 +77,4 @@ class MetadataFilter extends \FilterIterator implements \Countable
{
return count($this->getInnerIterator());
}
}
}

View File

@ -48,7 +48,7 @@ class CountWalker extends TreeWalkerAdapter
}
$rootComponents = array();
foreach ($this->_getQueryComponents() AS $dqlAlias => $qComp) {
foreach ($this->_getQueryComponents() as $dqlAlias => $qComp) {
$isParent = array_key_exists('parent', $qComp)
&& $qComp['parent'] === null
&& $qComp['nestingLevel'] == 0

View File

@ -59,7 +59,7 @@ class LimitSubqueryWalker extends TreeWalkerAdapter
$parentName = null;
$selectExpressions = array();
foreach ($this->_getQueryComponents() AS $dqlAlias => $qComp) {
foreach ($this->_getQueryComponents() as $dqlAlias => $qComp) {
// preserve mixed data in query for ordering
if (isset($qComp['resultVariable'])) {
$selectExpressions[] = new SelectExpression($qComp['resultVariable'], $dqlAlias);

View File

@ -69,7 +69,7 @@ class WhereInWalker extends TreeWalkerAdapter
public function walkSelectStatement(SelectStatement $AST)
{
$rootComponents = array();
foreach ($this->_getQueryComponents() AS $dqlAlias => $qComp) {
foreach ($this->_getQueryComponents() as $dqlAlias => $qComp) {
$isParent = array_key_exists('parent', $qComp)
&& $qComp['parent'] === null
&& $qComp['nestingLevel'] == 0

View File

@ -208,13 +208,13 @@ class SchemaTool
}
$pkColumns = array();
foreach ($class->identifier AS $identifierField) {
foreach ($class->identifier as $identifierField) {
if (isset($class->fieldMappings[$identifierField])) {
$pkColumns[] = $class->getQuotedColumnName($identifierField, $this->_platform);
} else if (isset($class->associationMappings[$identifierField])) {
/* @var $assoc \Doctrine\ORM\Mapping\OneToOne */
$assoc = $class->associationMappings[$identifierField];
foreach ($assoc['joinColumns'] AS $joinColumn) {
foreach ($assoc['joinColumns'] as $joinColumn) {
$pkColumns[] = $joinColumn['name'];
}
}
@ -224,19 +224,19 @@ class SchemaTool
}
if (isset($class->table['indexes'])) {
foreach ($class->table['indexes'] AS $indexName => $indexData) {
foreach ($class->table['indexes'] as $indexName => $indexData) {
$table->addIndex($indexData['columns'], is_numeric($indexName) ? null : $indexName);
}
}
if (isset($class->table['uniqueConstraints'])) {
foreach ($class->table['uniqueConstraints'] AS $indexName => $indexData) {
foreach ($class->table['uniqueConstraints'] as $indexName => $indexData) {
$table->addUniqueIndex($indexData['columns'], is_numeric($indexName) ? null : $indexName);
}
}
if (isset($class->table['options'])) {
foreach ($class->table['options'] AS $key => $val) {
foreach ($class->table['options'] as $key => $val) {
$table->addOption($key, $val);
}
}
@ -424,7 +424,7 @@ class SchemaTool
$this->_gatherRelationJoinColumns($mapping['joinColumns'], $table, $foreignClass, $mapping, $primaryKeyColumns, $uniqueConstraints);
foreach($uniqueConstraints AS $indexName => $unique) {
foreach($uniqueConstraints as $indexName => $unique) {
$table->addUniqueIndex($unique['columns'], is_numeric($indexName) ? null : $indexName);
}
} else if ($mapping['type'] == ClassMetadata::ONE_TO_MANY && $mapping['isOwningSide']) {
@ -446,7 +446,7 @@ class SchemaTool
$theJoinTable->setPrimaryKey($primaryKeyColumns);
foreach($uniqueConstraints AS $indexName => $unique) {
foreach($uniqueConstraints as $indexName => $unique) {
$theJoinTable->addUniqueIndex($unique['columns'], is_numeric($indexName) ? null : $indexName);
}
}
@ -474,7 +474,7 @@ class SchemaTool
return array($class, $referencedFieldName);
} else if (in_array($referencedColumnName, $class->getIdentifierColumnNames())) {
// it seems to be an entity as foreign key
foreach ($class->getIdentifierFieldNames() AS $fieldName) {
foreach ($class->getIdentifierFieldNames() as $fieldName) {
if ($class->hasAssociation($fieldName) && $class->getSingleAssociationJoinColumnName($fieldName) == $referencedColumnName) {
return $this->getDefiningClass(
$this->_em->getClassMetadata($class->associationMappings[$fieldName]['targetEntity']),
@ -627,9 +627,9 @@ class SchemaTool
$sm = $this->_em->getConnection()->getSchemaManager();
$fullSchema = $sm->createSchema();
foreach ($fullSchema->getTables() AS $table) {
foreach ($fullSchema->getTables() as $table) {
if (!$schema->hasTable($table->getName())) {
foreach ($table->getForeignKeys() AS $foreignKey) {
foreach ($table->getForeignKeys() as $foreignKey) {
/* @var $foreignKey \Doctrine\DBAL\Schema\ForeignKeyConstraint */
if ($schema->hasTable($foreignKey->getForeignTableName())) {
$visitor->acceptForeignKey($table, $foreignKey);
@ -637,17 +637,17 @@ class SchemaTool
}
} else {
$visitor->acceptTable($table);
foreach ($table->getForeignKeys() AS $foreignKey) {
foreach ($table->getForeignKeys() as $foreignKey) {
$visitor->acceptForeignKey($table, $foreignKey);
}
}
}
if ($this->_platform->supportsSequences()) {
foreach ($schema->getSequences() AS $sequence) {
foreach ($schema->getSequences() as $sequence) {
$visitor->acceptSequence($sequence);
}
foreach ($schema->getTables() AS $table) {
foreach ($schema->getTables() as $table) {
/* @var $sequence Table */
if ($table->hasPrimaryKey()) {
$columns = $table->getPrimaryKey()->getColumns();

View File

@ -68,7 +68,7 @@ class SchemaValidator
$cmf = $this->em->getMetadataFactory();
$classes = $cmf->getAllMetadata();
foreach ($classes AS $class) {
foreach ($classes as $class) {
if ($ce = $this->validateClass($class)) {
$errors[$class->name] = $ce;
}
@ -94,7 +94,7 @@ class SchemaValidator
}
}
foreach ($class->associationMappings AS $fieldName => $assoc) {
foreach ($class->associationMappings as $fieldName => $assoc) {
if (!class_exists($assoc['targetEntity']) || $cmf->isTransient($assoc['targetEntity'])) {
$ce[] = "The target entity '" . $assoc['targetEntity'] . "' specified on " . $class->name . '#' . $fieldName . ' is unknown or not an entity.';
return $ce;
@ -168,7 +168,7 @@ class SchemaValidator
if ($assoc['isOwningSide']) {
if ($assoc['type'] == ClassMetadataInfo::MANY_TO_MANY) {
$identifierColumns = $class->getIdentifierColumnNames();
foreach ($assoc['joinTable']['joinColumns'] AS $joinColumn) {
foreach ($assoc['joinTable']['joinColumns'] as $joinColumn) {
if (!in_array($joinColumn['referencedColumnName'], $identifierColumns)) {
$ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " .
"has to be a primary key column on the target entity class '".$class->name."'.";
@ -177,7 +177,7 @@ class SchemaValidator
}
$identifierColumns = $targetMetadata->getIdentifierColumnNames();
foreach ($assoc['joinTable']['inverseJoinColumns'] AS $inverseJoinColumn) {
foreach ($assoc['joinTable']['inverseJoinColumns'] as $inverseJoinColumn) {
if (!in_array($inverseJoinColumn['referencedColumnName'], $identifierColumns)) {
$ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " .
"has to be a primary key column on the target entity class '".$targetMetadata->name."'.";
@ -201,7 +201,7 @@ class SchemaValidator
} else if ($assoc['type'] & ClassMetadataInfo::TO_ONE) {
$identifierColumns = $targetMetadata->getIdentifierColumnNames();
foreach ($assoc['joinColumns'] AS $joinColumn) {
foreach ($assoc['joinColumns'] as $joinColumn) {
if (!in_array($joinColumn['referencedColumnName'], $identifierColumns)) {
$ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " .
"has to be a primary key column on the target entity class '".$targetMetadata->name."'.";
@ -210,7 +210,7 @@ class SchemaValidator
if (count($identifierColumns) != count($assoc['joinColumns'])) {
$ids = array();
foreach ($assoc['joinColumns'] AS $joinColumn) {
foreach ($assoc['joinColumns'] as $joinColumn) {
$ids[] = $joinColumn['name'];
}
@ -223,7 +223,7 @@ class SchemaValidator
}
if (isset($assoc['orderBy']) && $assoc['orderBy'] !== null) {
foreach ($assoc['orderBy'] AS $orderField => $orientation) {
foreach ($assoc['orderBy'] as $orderField => $orientation) {
if (!$targetMetadata->hasField($orderField)) {
$ce[] = "The association " . $class->name."#".$fieldName." is ordered by a foreign field " .
$orderField . " that is not a field on the target entity " . $targetMetadata->name;
@ -240,7 +240,7 @@ class SchemaValidator
"or protected. Public fields may break lazy-loading.";
}
foreach ($class->subClasses AS $subClass) {
foreach ($class->subClasses as $subClass) {
if (!in_array($class->name, class_parents($subClass))) {
$ce[] = "According to the discriminator map class '" . $subClass . "' has to be a child ".
"of '" . $class->name . "' but these entities are not related through inheritance.";

View File

@ -76,7 +76,7 @@ class Setup
$parts = explode(PATH_SEPARATOR, get_include_path());
foreach ($parts AS $includePath) {
foreach ($parts as $includePath) {
if ($includePath != "." && file_exists($includePath . "/Doctrine")) {
$loader = new ClassLoader("Symfony\Component", $includePath . "/Doctrine");
$loader->register();
@ -191,4 +191,4 @@ class Setup
return $config;
}
}
}