From 5f80b575541d53489f651f9d50aa44db5bdb49df Mon Sep 17 00:00:00 2001 From: Asmir Mustafic Date: Mon, 24 Oct 2011 10:19:01 +0200 Subject: [PATCH] Improoved coding standards --- lib/Doctrine/ORM/Tools/EntityGenerator.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index c135ecac4..1542f6cf0 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -635,7 +635,7 @@ public function () foreach ($metadata->associationMappings as $associationMapping) { if ($associationMapping['type'] & ClassMetadataInfo::TO_ONE) { $nullable = $this->_isAssociationIsNullable($associationMapping); - if ($code = $this->_generateEntityStubMethod($metadata, 'set', $associationMapping['fieldName'], $associationMapping['targetEntity'], ($nullable?'null':null))) { + if ($code = $this->_generateEntityStubMethod($metadata, 'set', $associationMapping['fieldName'], $associationMapping['targetEntity'], ($nullable ? 'null' : null))) { $methods[] = $code; } if ($code = $this->_generateEntityStubMethod($metadata, 'get', $associationMapping['fieldName'], $associationMapping['targetEntity'])) { @@ -656,16 +656,14 @@ public function () private function _isAssociationIsNullable($associationMapping) { - if(isset($associationMapping['joinColumns'])){ + if (isset($associationMapping['joinColumns'])) { $joinColumns = $associationMapping['joinColumns']; - }else{ + } else { //@todo thereis no way to retreive targetEntity metadata - //$targetMetadata = $this->getClassMetadata($associationMapping['targetEntity']); - //$joinColumns = $targetMetadata->associationMappings[$associationMapping["mappedBy"]]['joinColumns']; $joinColumns = array(); } foreach ($joinColumns as $joinColumn) { - if(isset($joinColumn['nullable']) && !$joinColumn['nullable']){ + if(isset($joinColumn['nullable']) && !$joinColumn['nullable']) { return false; } } @@ -756,7 +754,7 @@ public function () '' => Inflector::camelize($fieldName), '' => $methodName, '' => $fieldName, - '' => ($defaultValue!==null?('='.$defaultValue):''), + '' => (($defaultValue !== null ) ? ('='.$defaultValue) : ''), '' => $this->_getClassName($metadata) ); @@ -825,10 +823,10 @@ public function () { $lines = array(); $lines[] = $this->_spaces . '/**'; - + if ($associationMapping['type'] & ClassMetadataInfo::TO_MANY) { $lines[] = $this->_spaces . ' * @var \Doctrine\Common\Collections\ArrayCollection'; - }else{ + } else { $lines[] = $this->_spaces . ' * @var ' . $associationMapping['targetEntity']; }