Commit 72465c6f authored by Benjamin Eberlei's avatar Benjamin Eberlei

Fix CS: "AS" => "as" in foreach loops.

parent 92d1254e
......@@ -59,7 +59,7 @@ class Driver implements \Doctrine\DBAL\Driver
$driverOptions
);
foreach ($this->_userDefinedFunctions AS $fn => $data) {
foreach ($this->_userDefinedFunctions as $fn => $data) {
$pdo->sqliteCreateFunction($fn, $data['callback'], $data['numArgs']);
}
......@@ -113,4 +113,4 @@ class Driver implements \Doctrine\DBAL\Driver
$params = $conn->getParams();
return isset($params['path']) ? $params['path'] : null;
}
}
\ No newline at end of file
}
......@@ -64,7 +64,7 @@ class OracleSessionInit implements EventSubscriber
if (count($this->_defaultSessionVars)) {
array_change_key_case($this->_defaultSessionVars, \CASE_UPPER);
$vars = array();
foreach ($this->_defaultSessionVars AS $option => $value) {
foreach ($this->_defaultSessionVars as $option => $value) {
$vars[] = $option." = '".$value."'";
}
$sql = "ALTER SESSION SET ".implode(" ", $vars);
......
......@@ -1048,7 +1048,7 @@ abstract class AbstractPlatform
$options['primary'] = array();
if (($createFlags&self::CREATE_INDEXES) > 0) {
foreach ($table->getIndexes() AS $index) {
foreach ($table->getIndexes() as $index) {
/* @var $index Index */
if ($index->isPrimary()) {
$options['primary'] = $index->getColumns();
......@@ -1061,7 +1061,7 @@ abstract class AbstractPlatform
$columnSql = array();
$columns = array();
foreach ($table->getColumns() AS $column) {
foreach ($table->getColumns() as $column) {
/* @var \Doctrine\DBAL\Schema\Column $column */
if (null !== $this->_eventManager && $this->_eventManager->hasListeners(Events::onSchemaCreateTableColumn)) {
......@@ -1103,7 +1103,7 @@ abstract class AbstractPlatform
if (($createFlags&self::CREATE_FOREIGNKEYS) > 0) {
$options['foreignKeys'] = array();
foreach ($table->getForeignKeys() AS $fkConstraint) {
foreach ($table->getForeignKeys() as $fkConstraint) {
$options['foreignKeys'][] = $fkConstraint;
}
}
......@@ -1119,7 +1119,7 @@ abstract class AbstractPlatform
$sql = $this->_getCreateTableSQL($tableName, $columns, $options);
if ($this->supportsCommentOnStatement()) {
foreach ($table->getColumns() AS $column) {
foreach ($table->getColumns() as $column) {
if ($this->getColumnComment($column)) {
$sql[] = $this->getCommentOnColumnSQL($tableName, $column->getName(), $this->getColumnComment($column));
}
......@@ -1171,7 +1171,7 @@ abstract class AbstractPlatform
$sql[] = $query;
if (isset($options['foreignKeys'])) {
foreach ((array) $options['foreignKeys'] AS $definition) {
foreach ((array) $options['foreignKeys'] as $definition) {
$sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
}
}
......@@ -1242,7 +1242,7 @@ abstract class AbstractPlatform
$query .= ' FOREIGN KEY';
$foreignColumns = array();
foreach ($constraint->getForeignColumns() AS $column) {
foreach ($constraint->getForeignColumns() as $column) {
$foreignColumns[] = $column;
}
......@@ -1496,18 +1496,18 @@ abstract class AbstractPlatform
$sql = array();
if ($this->supportsForeignKeyConstraints()) {
foreach ($diff->removedForeignKeys AS $foreignKey) {
foreach ($diff->removedForeignKeys as $foreignKey) {
$sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName);
}
foreach ($diff->changedForeignKeys AS $foreignKey) {
foreach ($diff->changedForeignKeys as $foreignKey) {
$sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName);
}
}
foreach ($diff->removedIndexes AS $index) {
foreach ($diff->removedIndexes as $index) {
$sql[] = $this->getDropIndexSQL($index, $tableName);
}
foreach ($diff->changedIndexes AS $index) {
foreach ($diff->changedIndexes as $index) {
$sql[] = $this->getDropIndexSQL($index, $tableName);
}
......@@ -1524,18 +1524,18 @@ abstract class AbstractPlatform
$sql = array();
if ($this->supportsForeignKeyConstraints()) {
foreach ($diff->addedForeignKeys AS $foreignKey) {
foreach ($diff->addedForeignKeys as $foreignKey) {
$sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName);
}
foreach ($diff->changedForeignKeys AS $foreignKey) {
foreach ($diff->changedForeignKeys as $foreignKey) {
$sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName);
}
}
foreach ($diff->addedIndexes AS $index) {
foreach ($diff->addedIndexes as $index) {
$sql[] = $this->getCreateIndexSQL($index, $tableName);
}
foreach ($diff->changedIndexes AS $index) {
foreach ($diff->changedIndexes as $index) {
$sql[] = $this->getCreateIndexSQL($index, $tableName);
}
......
......@@ -376,7 +376,7 @@ class DB2Platform extends AbstractPlatform
$columnSql = array();
$queryParts = array();
foreach ($diff->addedColumns AS $fieldName => $column) {
foreach ($diff->addedColumns as $fieldName => $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue;
}
......@@ -384,7 +384,7 @@ class DB2Platform extends AbstractPlatform
$queryParts[] = 'ADD COLUMN ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
}
foreach ($diff->removedColumns AS $column) {
foreach ($diff->removedColumns as $column) {
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
continue;
}
......@@ -392,7 +392,7 @@ class DB2Platform extends AbstractPlatform
$queryParts[] = 'DROP COLUMN ' . $column->getQuotedName($this);
}
foreach ($diff->changedColumns AS $columnDiff) {
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
}
......@@ -403,7 +403,7 @@ class DB2Platform extends AbstractPlatform
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
}
foreach ($diff->renamedColumns AS $oldColumnName => $column) {
foreach ($diff->renamedColumns as $oldColumnName => $column) {
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
continue;
}
......@@ -584,4 +584,4 @@ class DB2Platform extends AbstractPlatform
{
return 'Doctrine\DBAL\Platforms\Keywords\DB2Keywords';
}
}
\ No newline at end of file
}
......@@ -302,7 +302,7 @@ class DrizzlePlatform extends AbstractPlatform
$queryParts[] = 'RENAME TO ' . $diff->newName;
}
foreach ($diff->addedColumns AS $fieldName => $column) {
foreach ($diff->addedColumns as $fieldName => $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue;
}
......@@ -312,7 +312,7 @@ class DrizzlePlatform extends AbstractPlatform
$queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
}
foreach ($diff->removedColumns AS $column) {
foreach ($diff->removedColumns as $column) {
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
continue;
}
......@@ -320,7 +320,7 @@ class DrizzlePlatform extends AbstractPlatform
$queryParts[] = 'DROP ' . $column->getQuotedName($this);
}
foreach ($diff->changedColumns AS $columnDiff) {
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
}
......@@ -333,7 +333,7 @@ class DrizzlePlatform extends AbstractPlatform
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
}
foreach ($diff->renamedColumns AS $oldColumnName => $column) {
foreach ($diff->renamedColumns as $oldColumnName => $column) {
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
continue;
}
......
......@@ -61,7 +61,7 @@ class ReservedKeywordsValidator implements Visitor
}
$keywordLists = array();
foreach ($this->keywordLists AS $keywordList) {
foreach ($this->keywordLists as $keywordList) {
if ($keywordList->isKeyword($word)) {
$keywordLists[] = $keywordList->getName();
}
......@@ -113,4 +113,4 @@ class ReservedKeywordsValidator implements Visitor
$this->isReservedWord($table->getName())
);
}
}
\ No newline at end of file
}
......@@ -460,7 +460,7 @@ class MySqlPlatform extends AbstractPlatform
$queryParts[] = 'RENAME TO ' . $diff->newName;
}
foreach ($diff->addedColumns AS $fieldName => $column) {
foreach ($diff->addedColumns as $fieldName => $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue;
}
......@@ -470,7 +470,7 @@ class MySqlPlatform extends AbstractPlatform
$queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
}
foreach ($diff->removedColumns AS $column) {
foreach ($diff->removedColumns as $column) {
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
continue;
}
......@@ -478,7 +478,7 @@ class MySqlPlatform extends AbstractPlatform
$queryParts[] = 'DROP ' . $column->getQuotedName($this);
}
foreach ($diff->changedColumns AS $columnDiff) {
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
}
......@@ -491,7 +491,7 @@ class MySqlPlatform extends AbstractPlatform
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
}
foreach ($diff->renamedColumns AS $oldColumnName => $column) {
foreach ($diff->renamedColumns as $oldColumnName => $column) {
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
continue;
}
......@@ -530,7 +530,7 @@ class MySqlPlatform extends AbstractPlatform
$sql = array();
$table = $diff->name;
foreach ($diff->removedIndexes AS $remKey => $remIndex) {
foreach ($diff->removedIndexes as $remKey => $remIndex) {
foreach ($diff->addedIndexes as $addKey => $addIndex) {
if ($remIndex->getColumns() == $addIndex->getColumns()) {
......
......@@ -572,7 +572,7 @@ LEFT JOIN user_cons_columns r_cols
$columnSql = array();
$fields = array();
foreach ($diff->addedColumns AS $column) {
foreach ($diff->addedColumns as $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue;
}
......@@ -587,7 +587,7 @@ LEFT JOIN user_cons_columns r_cols
}
$fields = array();
foreach ($diff->changedColumns AS $columnDiff) {
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
}
......@@ -602,7 +602,7 @@ LEFT JOIN user_cons_columns r_cols
$sql[] = 'ALTER TABLE ' . $diff->name . ' MODIFY (' . implode(', ', $fields) . ')';
}
foreach ($diff->renamedColumns AS $oldColumnName => $column) {
foreach ($diff->renamedColumns as $oldColumnName => $column) {
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
continue;
}
......@@ -611,7 +611,7 @@ LEFT JOIN user_cons_columns r_cols
}
$fields = array();
foreach ($diff->removedColumns AS $column) {
foreach ($diff->removedColumns as $column) {
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
continue;
}
......
......@@ -404,7 +404,7 @@ class PostgreSqlPlatform extends AbstractPlatform
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
}
foreach ($diff->changedColumns AS $columnDiff) {
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
}
......@@ -533,7 +533,7 @@ class PostgreSqlPlatform extends AbstractPlatform
$sql[] = $query;
if (isset($options['indexes']) && ! empty($options['indexes'])) {
foreach ($options['indexes'] AS $index) {
foreach ($options['indexes'] as $index) {
$sql[] = $this->getCreateIndexSQL($index, $tableName);
}
}
......
......@@ -213,13 +213,13 @@ class SQLServerPlatform extends AbstractPlatform
$sql[] = $query;
if (isset($options['indexes']) && !empty($options['indexes'])) {
foreach ($options['indexes'] AS $index) {
foreach ($options['indexes'] as $index) {
$sql[] = $this->getCreateIndexSQL($index, $tableName);
}
}
if (isset($options['foreignKeys'])) {
foreach ((array) $options['foreignKeys'] AS $definition) {
foreach ((array) $options['foreignKeys'] as $definition) {
$sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
}
}
......@@ -322,7 +322,7 @@ class SQLServerPlatform extends AbstractPlatform
$queryParts[] = 'RENAME TO ' . $diff->newName;
}
foreach ($diff->addedColumns AS $fieldName => $column) {
foreach ($diff->addedColumns as $fieldName => $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue;
}
......@@ -330,7 +330,7 @@ class SQLServerPlatform extends AbstractPlatform
$queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
}
foreach ($diff->removedColumns AS $column) {
foreach ($diff->removedColumns as $column) {
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
continue;
}
......@@ -338,7 +338,7 @@ class SQLServerPlatform extends AbstractPlatform
$queryParts[] = 'DROP COLUMN ' . $column->getQuotedName($this);
}
foreach ($diff->changedColumns AS $columnDiff) {
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
}
......@@ -349,7 +349,7 @@ class SQLServerPlatform extends AbstractPlatform
$this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
}
foreach ($diff->renamedColumns AS $oldColumnName => $column) {
foreach ($diff->renamedColumns as $oldColumnName => $column) {
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
continue;
}
......
......@@ -138,7 +138,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
return $rows;
}
foreach ($rows AS $num => $row) {
foreach ($rows as $num => $row) {
$rows[$num] = $this->fixRow($row, $iterateRow, $fixCase);
}
......@@ -156,7 +156,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
}
if ($iterateRow) {
foreach ($row AS $k => $v) {
foreach ($row as $k => $v) {
if (($this->portability & Connection::PORTABILITY_EMPTY_TO_NULL) && $v === '') {
$row[$k] = null;
} else if (($this->portability & Connection::PORTABILITY_RTRIM) && is_string($v)) {
......
......@@ -374,7 +374,7 @@ class QueryBuilder
if ($append) {
if ($sqlPartName == "orderBy" || $sqlPartName == "groupBy" || $sqlPartName == "select" || $sqlPartName == "set") {
foreach ($sqlPart AS $part) {
foreach ($sqlPart as $part) {
$this->sqlParts[$sqlPartName][] = $part;
}
} else if ($isArray && is_array($sqlPart[key($sqlPart)])) {
......@@ -1088,4 +1088,4 @@ class QueryBuilder
$this->setParameter($this->boundCounter, $value, $type);
return "?";
}
}
\ No newline at end of file
}
......@@ -88,7 +88,7 @@ class SQLParserUtils
$isPositional = is_int(key($params));
$arrayPositions = array();
$bindIndex = -1;
foreach ($types AS $name => $type) {
foreach ($types as $name => $type) {
++$bindIndex;
if ($type === Connection::PARAM_INT_ARRAY || $type === Connection::PARAM_STR_ARRAY) {
if ($isPositional) {
......@@ -107,7 +107,7 @@ class SQLParserUtils
if ($isPositional) {
$paramOffset = 0;
$queryOffset = 0;
foreach ($paramPos AS $needle => $needlePos) {
foreach ($paramPos as $needle => $needlePos) {
if (!isset($arrayPositions[$needle])) {
continue;
}
......
......@@ -175,7 +175,7 @@ abstract class AbstractAsset
{
$keywords = $platform->getReservedKeywordsList();
$parts = explode(".", $this->getName());
foreach ($parts AS $k => $v) {
foreach ($parts as $k => $v) {
$parts[$k] = ($this->_quoted || $keywords->isKeyword($v)) ? $platform->quoteIdentifier($v) : $v;
}
......
......@@ -238,7 +238,7 @@ abstract class AbstractSchemaManager
$tableNames = $this->listTableNames();
$tables = array();
foreach ($tableNames AS $tableName) {
foreach ($tableNames as $tableName) {
$tables[] = $this->listTableDetails($tableName);
}
......@@ -549,7 +549,7 @@ abstract class AbstractSchemaManager
{
$queries = $this->_platform->getAlterTableSQL($tableDiff);
if (is_array($queries) && count($queries)) {
foreach ($queries AS $ddlQuery) {
foreach ($queries as $ddlQuery) {
$this->_execSql($ddlQuery);
}
}
......@@ -698,7 +698,7 @@ abstract class AbstractSchemaManager
protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null)
{
$result = array();
foreach($tableIndexRows AS $tableIndex) {
foreach($tableIndexRows as $tableIndex) {
$indexName = $keyName = $tableIndex['key_name'];
if($tableIndex['primary']) {
$keyName = 'primary';
......@@ -721,7 +721,7 @@ abstract class AbstractSchemaManager
$eventManager = $this->_platform->getEventManager();
$indexes = array();
foreach($result AS $indexKey => $data) {
foreach($result as $indexKey => $data) {
$index = null;
$defaultPrevented = false;
......
......@@ -125,7 +125,7 @@ class Column extends AbstractAsset
*/
public function setOptions(array $options)
{
foreach ($options AS $name => $value) {
foreach ($options as $name => $value) {
$method = "set".$name;
if (method_exists($this, $method)) {
$this->$method($value);
......@@ -420,4 +420,4 @@ class Column extends AbstractAsset
'comment' => $this->_comment,
), $this->_platformOptions, $this->_customSchemaOptions);
}
}
\ No newline at end of file
}
......@@ -61,7 +61,7 @@ class Comparator
$foreignKeysToTable = array();
foreach ( $toSchema->getTables() AS $table ) {
foreach ( $toSchema->getTables() as $table ) {
$tableName = $table->getShortestName($toSchema->getName());
if ( ! $fromSchema->hasTable($tableName)) {
$diff->newTables[$tableName] = $toSchema->getTable($tableName);
......@@ -74,7 +74,7 @@ class Comparator
}
/* Check if there are tables removed */
foreach ($fromSchema->getTables() AS $table) {
foreach ($fromSchema->getTables() as $table) {
$tableName = $table->getShortestName($fromSchema->getName());
$table = $fromSchema->getTable($tableName);
......@@ -83,7 +83,7 @@ class Comparator
}
// also remember all foreign keys that point to a specific table
foreach ($table->getForeignKeys() AS $foreignKey) {
foreach ($table->getForeignKeys() as $foreignKey) {
$foreignTable = strtolower($foreignKey->getForeignTableName());
if (!isset($foreignKeysToTable[$foreignTable])) {
$foreignKeysToTable[$foreignTable] = array();
......@@ -92,13 +92,13 @@ class Comparator
}
}
foreach ($diff->removedTables AS $tableName => $table) {
foreach ($diff->removedTables as $tableName => $table) {
if (isset($foreignKeysToTable[$tableName])) {
$diff->orphanedForeignKeys = array_merge($diff->orphanedForeignKeys, $foreignKeysToTable[$tableName]);
}
}
foreach ($toSchema->getSequences() AS $sequence) {
foreach ($toSchema->getSequences() as $sequence) {
$sequenceName = $sequence->getShortestName($toSchema->getName());
if (!$fromSchema->hasSequence($sequenceName)) {
$diff->newSequences[] = $sequence;
......@@ -109,7 +109,7 @@ class Comparator
}
}
foreach ($fromSchema->getSequences() AS $sequence) {
foreach ($fromSchema->getSequences() as $sequence) {
$sequenceName = $sequence->getShortestName($fromSchema->getName());
if (!$toSchema->hasSequence($sequenceName)) {
$diff->removedSequences[] = $sequence;
......@@ -186,8 +186,8 @@ class Comparator
$table1Indexes = $table1->getIndexes();
$table2Indexes = $table2->getIndexes();
foreach ($table2Indexes AS $index2Name => $index2Definition) {
foreach ($table1Indexes AS $index1Name => $index1Definition) {
foreach ($table2Indexes as $index2Name => $index2Definition) {
foreach ($table1Indexes as $index1Name => $index1Definition) {
if ($this->diffIndex($index1Definition, $index2Definition) === false) {
unset($table1Indexes[$index1Name]);
unset($table2Indexes[$index2Name]);
......@@ -202,12 +202,12 @@ class Comparator
}
}
foreach ($table1Indexes AS $index1Name => $index1Definition) {
foreach ($table1Indexes as $index1Name => $index1Definition) {
$tableDifferences->removedIndexes[$index1Name] = $index1Definition;
$changes++;
}
foreach ($table2Indexes AS $index2Name => $index2Definition) {
foreach ($table2Indexes as $index2Name => $index2Definition) {
$tableDifferences->addedIndexes[$index2Name] = $index2Definition;
$changes++;
}
......@@ -215,8 +215,8 @@ class Comparator
$fromFkeys = $table1->getForeignKeys();
$toFkeys = $table2->getForeignKeys();
foreach ($fromFkeys AS $key1 => $constraint1) {
foreach ($toFkeys AS $key2 => $constraint2) {
foreach ($fromFkeys as $key1 => $constraint1) {
foreach ($toFkeys as $key2 => $constraint2) {
if($this->diffForeignKey($constraint1, $constraint2) === false) {
unset($fromFkeys[$key1]);
unset($toFkeys[$key2]);
......@@ -231,12 +231,12 @@ class Comparator
}
}
foreach ($fromFkeys AS $key1 => $constraint1) {
foreach ($fromFkeys as $key1 => $constraint1) {
$tableDifferences->removedForeignKeys[] = $constraint1;
$changes++;
}
foreach ($toFkeys AS $key2 => $constraint2) {
foreach ($toFkeys as $key2 => $constraint2) {
$tableDifferences->addedForeignKeys[] = $constraint2;
$changes++;
}
......@@ -253,15 +253,15 @@ class Comparator
private function detectColumnRenamings(TableDiff $tableDifferences)
{
$renameCandidates = array();
foreach ($tableDifferences->addedColumns AS $addedColumnName => $addedColumn) {
foreach ($tableDifferences->removedColumns AS $removedColumnName => $removedColumn) {
foreach ($tableDifferences->addedColumns as $addedColumnName => $addedColumn) {
foreach ($tableDifferences->removedColumns as $removedColumnName => $removedColumn) {
if (count($this->diffColumn($addedColumn, $removedColumn)) == 0) {
$renameCandidates[$addedColumn->getName()][] = array($removedColumn, $addedColumn, $addedColumnName);
}
}
}
foreach ($renameCandidates AS $candidate => $candidateColumns) {
foreach ($renameCandidates as $candidate => $candidateColumns) {
if (count($candidateColumns) == 1) {
list($removedColumn, $addedColumn) = $candidateColumns[0];
$removedColumnName = strtolower($removedColumn->getName());
......
......@@ -113,7 +113,7 @@ class DB2SchemaManager extends AbstractSchemaManager
protected function _getPortableTablesList($tables)
{
$tableNames = array();
foreach ($tables AS $tableRow) {
foreach ($tables as $tableRow) {
$tableRow = array_change_key_case($tableRow, \CASE_LOWER);
$tableNames[] = $tableRow['name'];
}
......@@ -126,7 +126,7 @@ class DB2SchemaManager extends AbstractSchemaManager
$tableIndexRows = array();
$indexes = array();
foreach($tableIndexes AS $indexKey => $data) {
foreach($tableIndexes as $indexKey => $data) {
$data = array_change_key_case($data, \CASE_LOWER);
$unique = ($data['uniquerule'] == "D") ? false : true;
$primary = ($data['uniquerule'] == "P");
......@@ -211,4 +211,4 @@ class DB2SchemaManager extends AbstractSchemaManager
return new View($view['name'], $sql);
}
}
\ No newline at end of file
}
......@@ -59,7 +59,7 @@ class Index extends AbstractAsset implements Constraint
$this->_isUnique = $isUnique;
$this->_isPrimary = $isPrimary;
foreach ($columns AS $column) {
foreach ($columns as $column) {
$this->_addColumn($column);
}
foreach ($flags as $flag) {
......
......@@ -52,7 +52,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
protected function _getPortableTableIndexesList($tableIndexes, $tableName=null)
{
foreach($tableIndexes AS $k => $v) {
foreach($tableIndexes as $k => $v) {
$v = array_change_key_case($v, CASE_LOWER);
if($v['key_name'] == 'PRIMARY') {
$v['primary'] = true;
......@@ -200,7 +200,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
}
$result = array();
foreach($list AS $constraint) {
foreach($list as $constraint) {
$result[] = new ForeignKeyConstraint(
array_values($constraint['local']), $constraint['foreignTable'],
array_values($constraint['foreign']), $constraint['name'],
......
......@@ -219,7 +219,7 @@ class OracleSchemaManager extends AbstractSchemaManager
}
$result = array();
foreach($list AS $constraint) {
foreach($list as $constraint) {
$result[] = new ForeignKeyConstraint(
array_values($constraint['local']), $constraint['foreignTable'],
array_values($constraint['foreign']), $constraint['name'],
......@@ -283,4 +283,4 @@ class OracleSchemaManager extends AbstractSchemaManager
return parent::dropTable($name);
}
}
\ No newline at end of file
}
......@@ -194,7 +194,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
protected function _getPortableTableIndexesList($tableIndexes, $tableName=null)
{
$buffer = array();
foreach ($tableIndexes AS $row) {
foreach ($tableIndexes as $row) {
$colNumbers = explode(' ', $row['indkey']);
$colNumbersSql = 'IN (' . join(' ,', $colNumbers) . ' )';
$columnNameSql = "SELECT attnum, attname FROM pg_attribute
......@@ -204,7 +204,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$indexColumns = $stmt->fetchAll();
// required for getting the order of the columns right.
foreach ($colNumbers AS $colNum) {
foreach ($colNumbers as $colNum) {
foreach ($indexColumns as $colRow) {
if ($colNum == $colRow['attnum']) {
$buffer[] = array(
......
......@@ -106,7 +106,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
{
// TODO: Remove code duplication with AbstractSchemaManager;
$result = array();
foreach ($tableIndexRows AS $tableIndex) {
foreach ($tableIndexRows as $tableIndex) {
$indexName = $keyName = $tableIndex['index_name'];
if (strpos($tableIndex['index_description'], 'primary key') !== false) {
$keyName = 'primary';
......@@ -132,7 +132,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
$eventManager = $this->_platform->getEventManager();
$indexes = array();
foreach ($result AS $indexKey => $data) {
foreach ($result as $indexKey => $data) {
$index = null;
$defaultPrevented = false;
......
......@@ -84,10 +84,10 @@ class Schema extends AbstractAsset
$this->_schemaConfig = $schemaConfig;
$this->_setName($schemaConfig->getName() ?: 'public');
foreach ($tables AS $table) {
foreach ($tables as $table) {
$this->_addTable($table);
}
foreach ($sequences AS $sequence) {
foreach ($sequences as $sequence) {
$this->_addSequence($sequence);
}
}
......@@ -342,10 +342,10 @@ class Schema extends AbstractAsset
{
$visitor->acceptSchema($this);
foreach ($this->_tables AS $table) {
foreach ($this->_tables as $table) {
$table->visit($visitor);
}
foreach ($this->_sequences AS $sequence) {
foreach ($this->_sequences as $sequence) {
$sequence->visit($visitor);
}
}
......@@ -357,10 +357,10 @@ class Schema extends AbstractAsset
*/
public function __clone()
{
foreach ($this->_tables AS $k => $table) {
foreach ($this->_tables as $k => $table) {
$this->_tables[$k] = clone $table;
}
foreach ($this->_sequences AS $k => $sequence) {
foreach ($this->_sequences as $k => $sequence) {
$this->_sequences[$k] = clone $sequence;
}
}
......
......@@ -125,36 +125,36 @@ class SchemaDiff
$sql = array();
if ($platform->supportsForeignKeyConstraints() && $saveMode == false) {
foreach ($this->orphanedForeignKeys AS $orphanedForeignKey) {
foreach ($this->orphanedForeignKeys as $orphanedForeignKey) {
$sql[] = $platform->getDropForeignKeySQL($orphanedForeignKey, $orphanedForeignKey->getLocalTableName());
}
}
if ($platform->supportsSequences() == true) {
foreach ($this->changedSequences AS $sequence) {
foreach ($this->changedSequences as $sequence) {
$sql[] = $platform->getAlterSequenceSQL($sequence);
}
if ($saveMode === false) {
foreach ($this->removedSequences AS $sequence) {
foreach ($this->removedSequences as $sequence) {
$sql[] = $platform->getDropSequenceSQL($sequence);
}
}
foreach ($this->newSequences AS $sequence) {
foreach ($this->newSequences as $sequence) {
$sql[] = $platform->getCreateSequenceSQL($sequence);
}
}
$foreignKeySql = array();
foreach ($this->newTables AS $table) {
foreach ($this->newTables as $table) {
$sql = array_merge(
$sql,
$platform->getCreateTableSQL($table, AbstractPlatform::CREATE_INDEXES)
);
if ($platform->supportsForeignKeyConstraints()) {
foreach ($table->getForeignKeys() AS $foreignKey) {
foreach ($table->getForeignKeys() as $foreignKey) {
$foreignKeySql[] = $platform->getCreateForeignKeySQL($foreignKey, $table);
}
}
......@@ -162,15 +162,15 @@ class SchemaDiff
$sql = array_merge($sql, $foreignKeySql);
if ($saveMode === false) {
foreach ($this->removedTables AS $table) {
foreach ($this->removedTables as $table) {
$sql[] = $platform->getDropTableSQL($table);
}
}
foreach ($this->changedTables AS $tableDiff) {
foreach ($this->changedTables as $tableDiff) {
$sql = array_merge($sql, $platform->getAlterTableSQL($tableDiff));
}
return $sql;
}
}
\ No newline at end of file
}
......@@ -80,7 +80,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
// fetch primary
$stmt = $this->_conn->executeQuery( "PRAGMA TABLE_INFO ('$tableName')" );
$indexArray = $stmt->fetchAll(\PDO::FETCH_ASSOC);
foreach($indexArray AS $indexColumnRow) {
foreach($indexArray as $indexColumnRow) {
if($indexColumnRow['pk'] == "1") {
$indexBuffer[] = array(
'key_name' => 'primary',
......@@ -92,7 +92,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
}
// fetch regular indexes
foreach($tableIndexes AS $tableIndex) {
foreach($tableIndexes as $tableIndex) {
// Ignore indexes with reserved names, e.g. autoindexes
if (strpos($tableIndex['name'], 'sqlite_') !== 0) {
$keyName = $tableIndex['name'];
......@@ -187,4 +187,4 @@ class SqliteSchemaManager extends AbstractSchemaManager
{
return new View($view['name'], $view['sql']);
}
}
\ No newline at end of file
}
......@@ -89,15 +89,15 @@ class Table extends AbstractAsset
$this->_setName($tableName);
$this->_idGeneratorType = $idGeneratorType;
foreach ($columns AS $column) {
foreach ($columns as $column) {
$this->_addColumn($column);
}
foreach ($indexes AS $idx) {
foreach ($indexes as $idx) {
$this->_addIndex($idx);
}
foreach ($fkConstraints AS $constraint) {
foreach ($fkConstraints as $constraint) {
$this->_addForeignKeyConstraint($constraint);
}
......@@ -135,7 +135,7 @@ class Table extends AbstractAsset
{
$primaryKey = $this->_createIndex($columns, $indexName ?: "primary", true, true);
foreach ($columns AS $columnName) {
foreach ($columns as $columnName) {
$column = $this->getColumn($columnName);
$column->setNotnull(true);
}
......@@ -211,7 +211,7 @@ class Table extends AbstractAsset
*/
public function columnsAreIndexed(array $columnsNames)
{
foreach ($this->getIndexes() AS $index) {
foreach ($this->getIndexes() as $index) {
/* @var $index Index */
if ($index->spansColumns($columnsNames)) {
return true;
......@@ -234,7 +234,7 @@ class Table extends AbstractAsset
throw SchemaException::indexNameInvalid($indexName);
}
foreach ($columnNames AS $columnName => $indexColOptions) {
foreach ($columnNames as $columnName => $indexColOptions) {
if (is_numeric($columnName) && is_string($indexColOptions)) {
$columnName = $indexColOptions;
}
......@@ -357,7 +357,7 @@ class Table extends AbstractAsset
if ($foreignTable instanceof Table) {
$foreignTableName = $foreignTable->getName();
foreach ($foreignColumnNames AS $columnName) {
foreach ($foreignColumnNames as $columnName) {
if ( ! $foreignTable->hasColumn($columnName)) {
throw SchemaException::columnDoesNotExist($columnName, $foreignTable->getName());
}
......@@ -366,7 +366,7 @@ class Table extends AbstractAsset
$foreignTableName = $foreignTable;
}
foreach ($localColumnNames AS $columnName) {
foreach ($localColumnNames as $columnName) {
if ( ! $this->hasColumn($columnName)) {
throw SchemaException::columnDoesNotExist($columnName, $this->_name);
}
......@@ -415,7 +415,7 @@ class Table extends AbstractAsset
protected function _addIndex(Index $indexCandidate)
{
// check for duplicates
foreach ($this->_indexes AS $existingIndex) {
foreach ($this->_indexes as $existingIndex) {
if ($indexCandidate->isFullfilledBy($existingIndex)) {
return $this;
}
......@@ -429,7 +429,7 @@ class Table extends AbstractAsset
}
// remove overruled indexes
foreach ($this->_indexes AS $idxKey => $existingIndex) {
foreach ($this->_indexes as $idxKey => $existingIndex) {
if ($indexCandidate->overrules($existingIndex)) {
unset($this->_indexes[$idxKey]);
}
......@@ -515,7 +515,7 @@ class Table extends AbstractAsset
if ($this->hasPrimaryKey()) {
$pkCols = $this->getPrimaryKey()->getColumns();
}
foreach ($this->getForeignKeys() AS $fk) {
foreach ($this->getForeignKeys() as $fk) {
/* @var $fk ForeignKeyConstraint */
$fkCols = array_merge($fkCols, $fk->getColumns());
}
......@@ -640,15 +640,15 @@ class Table extends AbstractAsset
{
$visitor->acceptTable($this);
foreach ($this->getColumns() AS $column) {
foreach ($this->getColumns() as $column) {
$visitor->acceptColumn($this, $column);
}
foreach ($this->getIndexes() AS $index) {
foreach ($this->getIndexes() as $index) {
$visitor->acceptIndex($this, $index);
}
foreach ($this->getForeignKeys() AS $constraint) {
foreach ($this->getForeignKeys() as $constraint) {
$visitor->acceptForeignKey($this, $constraint);
}
}
......@@ -658,13 +658,13 @@ class Table extends AbstractAsset
*/
public function __clone()
{
foreach ($this->_columns AS $k => $column) {
foreach ($this->_columns as $k => $column) {
$this->_columns[$k] = clone $column;
}
foreach ($this->_indexes AS $k => $index) {
foreach ($this->_indexes as $k => $index) {
$this->_indexes[$k] = clone $index;
}
foreach ($this->_fkConstraints AS $k => $fk) {
foreach ($this->_fkConstraints as $k => $fk) {
$this->_fkConstraints[$k] = clone $fk;
$this->_fkConstraints[$k]->setLocalTable($this);
}
......
......@@ -141,16 +141,16 @@ class DropSchemaSqlCollector implements Visitor
public function getQueries()
{
$sql = array();
foreach ($this->constraints AS $fkConstraint) {
foreach ($this->constraints as $fkConstraint) {
$localTable = $this->constraints[$fkConstraint];
$sql[] = $this->platform->getDropForeignKeySQL($fkConstraint, $localTable);
}
foreach ($this->sequences AS $sequence) {
foreach ($this->sequences as $sequence) {
$sql[] = $this->platform->getDropSequenceSQL($sequence);
}
foreach ($this->tables AS $table) {
foreach ($this->tables as $table) {
$sql[] = $this->platform->getDropTableSQL($table);
}
......
......@@ -102,7 +102,7 @@ EOT
}
$keywords = array();
foreach ($keywordLists AS $keywordList) {
foreach ($keywordLists as $keywordList) {
if (!isset($this->keywordListClasses[$keywordList])) {
throw new \InvalidArgumentException(
"There exists no keyword list with name '" . $keywordList . "'. ".
......@@ -125,7 +125,7 @@ EOT
$output->write("No reserved keywords violations have been found!", true);
} else {
$output->write('There are <error>' . count($violations) . '</error> reserved keyword violations in your database schema:', true);
foreach ($violations AS $violation) {
foreach ($violations as $violation) {
$output->write(' - ' . $violation, true);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment