From bb873826ca4f53e02086cdb7f49913592d6afec3 Mon Sep 17 00:00:00 2001 From: Miha Vrhovnik Date: Fri, 27 May 2011 08:41:31 +0200 Subject: [PATCH] Fixing Notice: Undefined index: orderBy in ...Doctrine/ORM/Tools/Export/Driver/YamlExporter --- .../ORM/Tools/Export/Driver/YamlExporter.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php index 1cc699610..d5c1efd8a 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/YamlExporter.php @@ -43,7 +43,7 @@ class YamlExporter extends AbstractExporter * * TODO: Should this code be pulled out in to a toArray() method in ClassMetadata * - * @param ClassMetadataInfo $metadata + * @param ClassMetadataInfo $metadata * @return mixed $exported */ public function exportClassMetadata(ClassMetadataInfo $metadata) @@ -84,9 +84,9 @@ class YamlExporter extends AbstractExporter if (isset($metadata->table['uniqueConstraints'])) { $array['uniqueConstraints'] = $metadata->table['uniqueConstraints']; } - + $fieldMappings = $metadata->fieldMappings; - + $ids = array(); foreach ($fieldMappings as $name => $fieldMapping) { $fieldMapping['column'] = $fieldMapping['columnName']; @@ -94,7 +94,7 @@ class YamlExporter extends AbstractExporter $fieldMapping['columnName'], $fieldMapping['fieldName'] ); - + if ($fieldMapping['column'] == $name) { unset($fieldMapping['column']); } @@ -111,7 +111,7 @@ class YamlExporter extends AbstractExporter if ($idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { $ids[$metadata->getSingleIdentifierFieldName()]['generator']['strategy'] = $this->_getIdGeneratorTypeString($metadata->generatorType); } - + if ($ids) { $array['fields'] = $ids; } @@ -145,7 +145,7 @@ class YamlExporter extends AbstractExporter 'targetEntity' => $associationMapping['targetEntity'], 'cascade' => $cascade, ); - + if ($associationMapping['type'] & ClassMetadataInfo::TO_ONE) { $joinColumns = $associationMapping['joinColumns']; $newJoinColumns = array(); @@ -164,7 +164,7 @@ class YamlExporter extends AbstractExporter 'joinColumns' => $newJoinColumns, 'orphanRemoval' => $associationMapping['orphanRemoval'], ); - + $associationMappingArray = array_merge($associationMappingArray, $oneToOneMappingArray); $array['oneToOne'][$name] = $associationMappingArray; } else if ($associationMapping['type'] == ClassMetadataInfo::ONE_TO_MANY) { @@ -172,7 +172,7 @@ class YamlExporter extends AbstractExporter 'mappedBy' => $associationMapping['mappedBy'], 'inversedBy' => $associationMapping['inversedBy'], 'orphanRemoval' => $associationMapping['orphanRemoval'], - 'orderBy' => $associationMapping['orderBy'] + 'orderBy' => isset($associationMapping['orderBy']) ? $associationMapping['orderBy'] : null ); $associationMappingArray = array_merge($associationMappingArray, $oneToManyMappingArray); @@ -182,9 +182,9 @@ class YamlExporter extends AbstractExporter 'mappedBy' => $associationMapping['mappedBy'], 'inversedBy' => $associationMapping['inversedBy'], 'joinTable' => $associationMapping['joinTable'], - 'orderBy' => isset($associationMapping['orderBy']) ? $associationMapping['orderBy'] : null + 'orderBy' => isset($associationMapping['orderBy']) ? $associationMapping['orderBy'] : null ); - + $associationMappingArray = array_merge($associationMappingArray, $manyToManyMappingArray); $array['manyToMany'][$name] = $associationMappingArray; }