From df82b6060b7857a681e3568034115c6cb8b2a967 Mon Sep 17 00:00:00 2001 From: Rivaros Date: Mon, 13 Feb 2012 15:05:28 +0200 Subject: [PATCH] Convention fixes --- lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php | 3 ++- .../ORM/Mapping/Driver/DatabaseDriver.php | 17 +++++++---------- lib/Doctrine/ORM/Tools/EntityGenerator.php | 4 +--- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index 4efdaf44f..826f986c3 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -1224,8 +1224,9 @@ class ClassMetadataInfo implements ClassMetadata foreach ($mapping['joinColumns'] as $key => &$joinColumn) { if ($mapping['type'] === self::ONE_TO_ONE && ! $this->isInheritanceTypeSingleTable()) { if (count($mapping['joinColumns']) == 1) { - if(! isset($mapping['id']) || ! $mapping['id']) + if (! isset($mapping['id']) || ! $mapping['id']) { $joinColumn['unique'] = true; + } } else { $uniqueContraintColumns[] = $joinColumn['name']; } diff --git a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php index 49f9fcf6c..49a389ada 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php @@ -300,10 +300,9 @@ class DatabaseDriver implements Driver $associationMapping['fieldName'] = $this->getFieldNameForColumn($tableName, $localColumn, true); $associationMapping['targetEntity'] = $this->getClassNameForTable($foreignTable); - if ($primaryKeyColumns && in_array($localColumn, $primaryKeyColumns)) - { - $associationMapping['id'] = true; - } + if ($primaryKeyColumns && in_array($localColumn, $primaryKeyColumns)) { + $associationMapping['id'] = true; + } for ($i = 0; $i < count($cols); $i++) { $associationMapping['joinColumns'][] = array( @@ -312,15 +311,13 @@ class DatabaseDriver implements Driver ); } - //Here we need to check if $cols are the same as $primaryKeyColums - if(!array_diff($cols,$primaryKeyColumns)) + if(!array_diff($cols,$primaryKeyColumns)) { $metadata->mapOneToOne($associationMapping); - else + } + else { $metadata->mapManyToOne($associationMapping); - - - + } } } diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 324165b8c..a6d52175a 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -894,10 +894,8 @@ public function () $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . 'Id'; if ($generatorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { - $lines[] = $this->_spaces.' * @' . $this->_annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; + $lines[] = $this->_spaces . ' * @' . $this->_annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; } - - } $type = null;