Skip to content

Commit

Permalink
Convention fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rivaros authored and beberlei committed Mar 14, 2012
1 parent 79c8f42 commit 8c8deb9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -1209,8 +1209,9 @@ protected function _validateAndCompleteOneToOneMapping(array $mapping)
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'];
}
Expand Down
17 changes: 7 additions & 10 deletions lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,9 @@ public function loadMetadataForClass($className, ClassMetadataInfo $metadata)
$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(
Expand All @@ -312,15 +311,13 @@ public function loadMetadataForClass($className, ClassMetadataInfo $metadata)
);
}


//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);



}
}
}

Expand Down
4 changes: 1 addition & 3 deletions lib/Doctrine/ORM/Tools/EntityGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -867,10 +867,8 @@ private function _generateAssociationMappingPropertyDocBlock(array $associationM
$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;
Expand Down

0 comments on commit 8c8deb9

Please sign in to comment.