From 5730a32d918a22dc61fe81f5a1dae09b9cd8ce89 Mon Sep 17 00:00:00 2001 From: romanb Date: Mon, 7 Dec 2009 13:04:54 +0000 Subject: [PATCH] [2.0] Fixed more STRICT standards notices (only variables should be passed by reference...). @beberlei, error_reporting=E_ALL | E_STRICT --- lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php | 8 +++++--- .../Functional/Schema/SchemaManagerFunctionalTestCase.php | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php index b71889d40..0e579df63 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php @@ -132,14 +132,16 @@ class DatabaseDriver implements Driver "Cannot generate mapping for table '".$tableName."' with foreign keys with multiple local columns." ); } - $localColumn = current($foreignKey->getColumns()); + $cols = $foreignKey->getColumns(); + $localColumn = current($cols); - if (count($foreignKey->getForeignColumns()) != 1) { + $fkCols = $foreignKey->getForeignColumns(); + if (count($fkCols) != 1) { throw new MappingException( "Cannot generate mapping for table '".$tableName."' with foreign keys with multiple foreign columns." ); } - $foreignColumn = current($foreignKey->getForeignColumns()); + $foreignColumn = current($fkCols); $associationMapping = array(); $associationMapping['fieldName'] = Inflector::camelize(str_ireplace('_id', '', $localColumn)); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php index 183d4ec56..b0c06ce9b 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -346,7 +346,8 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest $this->assertFalse($table->hasIndex('foo_idx')); $this->assertEquals(1, count($table->getForeignKeys())); - $foreignKey = current($table->getForeignKeys()); + $fks = $table->getForeignKeys(); + $foreignKey = current($fks); $this->assertEquals('alter_table_foreign', strtolower($foreignKey->getForeignTableName())); $this->assertEquals(array('foreign_key_test'), array_map('strtolower', $foreignKey->getColumns())); $this->assertEquals(array('id'), array_map('strtolower', $foreignKey->getForeignColumns()));