Merge pull request #62 from mvrhov/yml_export_notice_fix
Fixing Notice: Undefined index in yaml export driver
This commit is contained in:
commit
ff30f86082
@ -43,7 +43,7 @@ class YamlExporter extends AbstractExporter
|
|||||||
*
|
*
|
||||||
* TODO: Should this code be pulled out in to a toArray() method in ClassMetadata
|
* TODO: Should this code be pulled out in to a toArray() method in ClassMetadata
|
||||||
*
|
*
|
||||||
* @param ClassMetadataInfo $metadata
|
* @param ClassMetadataInfo $metadata
|
||||||
* @return mixed $exported
|
* @return mixed $exported
|
||||||
*/
|
*/
|
||||||
public function exportClassMetadata(ClassMetadataInfo $metadata)
|
public function exportClassMetadata(ClassMetadataInfo $metadata)
|
||||||
@ -84,9 +84,9 @@ class YamlExporter extends AbstractExporter
|
|||||||
if (isset($metadata->table['uniqueConstraints'])) {
|
if (isset($metadata->table['uniqueConstraints'])) {
|
||||||
$array['uniqueConstraints'] = $metadata->table['uniqueConstraints'];
|
$array['uniqueConstraints'] = $metadata->table['uniqueConstraints'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$fieldMappings = $metadata->fieldMappings;
|
$fieldMappings = $metadata->fieldMappings;
|
||||||
|
|
||||||
$ids = array();
|
$ids = array();
|
||||||
foreach ($fieldMappings as $name => $fieldMapping) {
|
foreach ($fieldMappings as $name => $fieldMapping) {
|
||||||
$fieldMapping['column'] = $fieldMapping['columnName'];
|
$fieldMapping['column'] = $fieldMapping['columnName'];
|
||||||
@ -94,7 +94,7 @@ class YamlExporter extends AbstractExporter
|
|||||||
$fieldMapping['columnName'],
|
$fieldMapping['columnName'],
|
||||||
$fieldMapping['fieldName']
|
$fieldMapping['fieldName']
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($fieldMapping['column'] == $name) {
|
if ($fieldMapping['column'] == $name) {
|
||||||
unset($fieldMapping['column']);
|
unset($fieldMapping['column']);
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ class YamlExporter extends AbstractExporter
|
|||||||
if ($idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) {
|
if ($idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) {
|
||||||
$ids[$metadata->getSingleIdentifierFieldName()]['generator']['strategy'] = $this->_getIdGeneratorTypeString($metadata->generatorType);
|
$ids[$metadata->getSingleIdentifierFieldName()]['generator']['strategy'] = $this->_getIdGeneratorTypeString($metadata->generatorType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ids) {
|
if ($ids) {
|
||||||
$array['fields'] = $ids;
|
$array['fields'] = $ids;
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ class YamlExporter extends AbstractExporter
|
|||||||
'targetEntity' => $associationMapping['targetEntity'],
|
'targetEntity' => $associationMapping['targetEntity'],
|
||||||
'cascade' => $cascade,
|
'cascade' => $cascade,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($associationMapping['type'] & ClassMetadataInfo::TO_ONE) {
|
if ($associationMapping['type'] & ClassMetadataInfo::TO_ONE) {
|
||||||
$joinColumns = $associationMapping['joinColumns'];
|
$joinColumns = $associationMapping['joinColumns'];
|
||||||
$newJoinColumns = array();
|
$newJoinColumns = array();
|
||||||
@ -164,7 +164,7 @@ class YamlExporter extends AbstractExporter
|
|||||||
'joinColumns' => $newJoinColumns,
|
'joinColumns' => $newJoinColumns,
|
||||||
'orphanRemoval' => $associationMapping['orphanRemoval'],
|
'orphanRemoval' => $associationMapping['orphanRemoval'],
|
||||||
);
|
);
|
||||||
|
|
||||||
$associationMappingArray = array_merge($associationMappingArray, $oneToOneMappingArray);
|
$associationMappingArray = array_merge($associationMappingArray, $oneToOneMappingArray);
|
||||||
$array['oneToOne'][$name] = $associationMappingArray;
|
$array['oneToOne'][$name] = $associationMappingArray;
|
||||||
} else if ($associationMapping['type'] == ClassMetadataInfo::ONE_TO_MANY) {
|
} else if ($associationMapping['type'] == ClassMetadataInfo::ONE_TO_MANY) {
|
||||||
@ -172,7 +172,7 @@ class YamlExporter extends AbstractExporter
|
|||||||
'mappedBy' => $associationMapping['mappedBy'],
|
'mappedBy' => $associationMapping['mappedBy'],
|
||||||
'inversedBy' => $associationMapping['inversedBy'],
|
'inversedBy' => $associationMapping['inversedBy'],
|
||||||
'orphanRemoval' => $associationMapping['orphanRemoval'],
|
'orphanRemoval' => $associationMapping['orphanRemoval'],
|
||||||
'orderBy' => $associationMapping['orderBy']
|
'orderBy' => isset($associationMapping['orderBy']) ? $associationMapping['orderBy'] : null
|
||||||
);
|
);
|
||||||
|
|
||||||
$associationMappingArray = array_merge($associationMappingArray, $oneToManyMappingArray);
|
$associationMappingArray = array_merge($associationMappingArray, $oneToManyMappingArray);
|
||||||
@ -182,9 +182,9 @@ class YamlExporter extends AbstractExporter
|
|||||||
'mappedBy' => $associationMapping['mappedBy'],
|
'mappedBy' => $associationMapping['mappedBy'],
|
||||||
'inversedBy' => $associationMapping['inversedBy'],
|
'inversedBy' => $associationMapping['inversedBy'],
|
||||||
'joinTable' => $associationMapping['joinTable'],
|
'joinTable' => $associationMapping['joinTable'],
|
||||||
'orderBy' => isset($associationMapping['orderBy']) ? $associationMapping['orderBy'] : null
|
'orderBy' => isset($associationMapping['orderBy']) ? $associationMapping['orderBy'] : null
|
||||||
);
|
);
|
||||||
|
|
||||||
$associationMappingArray = array_merge($associationMappingArray, $manyToManyMappingArray);
|
$associationMappingArray = array_merge($associationMappingArray, $manyToManyMappingArray);
|
||||||
$array['manyToMany'][$name] = $associationMappingArray;
|
$array['manyToMany'][$name] = $associationMappingArray;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user