Fixed #DDC-580
This commit is contained in:
parent
c2d2e45859
commit
b63afb6ce4
@ -65,11 +65,11 @@ class XmlDriver extends AbstractFileDriver
|
||||
if (isset($xmlRoot['table'])) {
|
||||
$metadata->table['name'] = (string)$xmlRoot['table'];
|
||||
}
|
||||
|
||||
|
||||
if (isset($xmlRoot['schema'])) {
|
||||
$metadata->table['schema'] = (string)$xmlRoot['schema'];
|
||||
}
|
||||
|
||||
|
||||
if (isset($xmlRoot['inheritance-type'])) {
|
||||
$inheritanceType = (string)$xmlRoot['inheritance-type'];
|
||||
$metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceType));
|
||||
@ -108,13 +108,13 @@ class XmlDriver extends AbstractFileDriver
|
||||
} else {
|
||||
$columns = $index['columns'];
|
||||
}
|
||||
|
||||
|
||||
$metadata->table['indexes'][$index['name']] = array(
|
||||
'columns' => $columns
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Evaluate <unique-constraints..>
|
||||
if (isset($xmlRoot->{'unique-constraints'})) {
|
||||
foreach ($xmlRoot->{'unique-constraints'}->{'unique-constraint'} as $unique) {
|
||||
@ -139,27 +139,27 @@ class XmlDriver extends AbstractFileDriver
|
||||
'fieldName' => (string)$fieldMapping['name'],
|
||||
'type' => (string)$fieldMapping['type']
|
||||
);
|
||||
|
||||
|
||||
if (isset($fieldMapping['column'])) {
|
||||
$mapping['columnName'] = (string)$fieldMapping['column'];
|
||||
}
|
||||
|
||||
|
||||
if (isset($fieldMapping['length'])) {
|
||||
$mapping['length'] = (int)$fieldMapping['length'];
|
||||
}
|
||||
|
||||
|
||||
if (isset($fieldMapping['precision'])) {
|
||||
$mapping['precision'] = (int)$fieldMapping['precision'];
|
||||
}
|
||||
|
||||
|
||||
if (isset($fieldMapping['scale'])) {
|
||||
$mapping['scale'] = (int)$fieldMapping['scale'];
|
||||
}
|
||||
|
||||
|
||||
if (isset($fieldMapping['unique'])) {
|
||||
$mapping['unique'] = ((string)$fieldMapping['unique'] == "false") ? false : true;
|
||||
}
|
||||
|
||||
|
||||
if (isset($fieldMapping['options'])) {
|
||||
$mapping['options'] = (array)$fieldMapping['options'];
|
||||
}
|
||||
@ -167,15 +167,15 @@ class XmlDriver extends AbstractFileDriver
|
||||
if (isset($fieldMapping['nullable'])) {
|
||||
$mapping['nullable'] = ((string)$fieldMapping['nullable'] == "false") ? false : true;
|
||||
}
|
||||
|
||||
|
||||
if (isset($fieldMapping['version']) && $fieldMapping['version']) {
|
||||
$metadata->setVersionMapping($mapping);
|
||||
}
|
||||
|
||||
|
||||
if (isset($fieldMapping['column-definition'])) {
|
||||
$mapping['columnDefinition'] = (string)$fieldMapping['column-definition'];
|
||||
}
|
||||
|
||||
|
||||
$metadata->mapField($mapping);
|
||||
}
|
||||
}
|
||||
@ -187,11 +187,11 @@ class XmlDriver extends AbstractFileDriver
|
||||
'fieldName' => (string)$idElement['name'],
|
||||
'type' => (string)$idElement['type']
|
||||
);
|
||||
|
||||
|
||||
if (isset($idElement['column'])) {
|
||||
$mapping['columnName'] = (string)$idElement['column'];
|
||||
}
|
||||
|
||||
|
||||
$metadata->mapField($mapping);
|
||||
|
||||
if (isset($idElement->generator)) {
|
||||
@ -221,11 +221,11 @@ class XmlDriver extends AbstractFileDriver
|
||||
'fieldName' => (string)$oneToOneElement['field'],
|
||||
'targetEntity' => (string)$oneToOneElement['target-entity']
|
||||
);
|
||||
|
||||
|
||||
if (isset($oneToOneElement['fetch'])) {
|
||||
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\AssociationMapping::FETCH_' . (string)$oneToOneElement['fetch']);
|
||||
}
|
||||
|
||||
|
||||
if (isset($oneToOneElement['mapped-by'])) {
|
||||
$mapping['mappedBy'] = (string)$oneToOneElement['mapped-by'];
|
||||
} else {
|
||||
@ -233,7 +233,7 @@ class XmlDriver extends AbstractFileDriver
|
||||
$mapping['inversedBy'] = (string)$oneToOneElement['inversed-by'];
|
||||
}
|
||||
$joinColumns = array();
|
||||
|
||||
|
||||
if (isset($oneToOneElement->{'join-column'})) {
|
||||
$joinColumns[] = $this->_getJoinColumnMapping($oneToOneElement->{'join-column'});
|
||||
} else if (isset($oneToOneElement->{'join-columns'})) {
|
||||
@ -241,10 +241,10 @@ class XmlDriver extends AbstractFileDriver
|
||||
$joinColumns[] = $this->_getJoinColumnMapping($joinColumnElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$mapping['joinColumns'] = $joinColumns;
|
||||
}
|
||||
|
||||
|
||||
if (isset($oneToOneElement->cascade)) {
|
||||
$mapping['cascade'] = $this->_getCascadeMappings($oneToOneElement->cascade);
|
||||
}
|
||||
@ -252,7 +252,7 @@ class XmlDriver extends AbstractFileDriver
|
||||
if (isset($oneToOneElement->{'orphan-removal'})) {
|
||||
$mapping['orphanRemoval'] = (bool)$oneToOneElement->{'orphan-removal'};
|
||||
}
|
||||
|
||||
|
||||
$metadata->mapOneToOne($mapping);
|
||||
}
|
||||
}
|
||||
@ -265,15 +265,15 @@ class XmlDriver extends AbstractFileDriver
|
||||
'targetEntity' => (string)$oneToManyElement['target-entity'],
|
||||
'mappedBy' => (string)$oneToManyElement['mapped-by']
|
||||
);
|
||||
|
||||
|
||||
if (isset($oneToManyElement['fetch'])) {
|
||||
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\AssociationMapping::FETCH_' . (string)$oneToManyElement['fetch']);
|
||||
}
|
||||
|
||||
|
||||
if (isset($oneToManyElement->cascade)) {
|
||||
$mapping['cascade'] = $this->_getCascadeMappings($oneToManyElement->cascade);
|
||||
}
|
||||
|
||||
|
||||
if (isset($oneToManyElement->{'orphan-removal'})) {
|
||||
$mapping['orphanRemoval'] = (bool)$oneToManyElement->{'orphan-removal'};
|
||||
}
|
||||
@ -285,11 +285,11 @@ class XmlDriver extends AbstractFileDriver
|
||||
}
|
||||
$mapping['orderBy'] = $orderBy;
|
||||
}
|
||||
|
||||
|
||||
$metadata->mapOneToMany($mapping);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Evaluate <many-to-one ...> mappings
|
||||
if (isset($xmlRoot->{'many-to-one'})) {
|
||||
foreach ($xmlRoot->{'many-to-one'} as $manyToOneElement) {
|
||||
@ -297,7 +297,7 @@ class XmlDriver extends AbstractFileDriver
|
||||
'fieldName' => (string)$manyToOneElement['field'],
|
||||
'targetEntity' => (string)$manyToOneElement['target-entity']
|
||||
);
|
||||
|
||||
|
||||
if (isset($manyToOneElement['fetch'])) {
|
||||
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\AssociationMapping::FETCH_' . (string)$manyToOneElement['fetch']);
|
||||
}
|
||||
@ -324,15 +324,15 @@ class XmlDriver extends AbstractFileDriver
|
||||
if (isset($manyToOneElement->cascade)) {
|
||||
$mapping['cascade'] = $this->_getCascadeMappings($manyToOneElement->cascade);
|
||||
}
|
||||
|
||||
|
||||
if (isset($manyToOneElement->{'orphan-removal'})) {
|
||||
$mapping['orphanRemoval'] = (bool)$manyToOneElement->{'orphan-removal'};
|
||||
}
|
||||
|
||||
|
||||
$metadata->mapManyToOne($mapping);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Evaluate <many-to-many ...> mappings
|
||||
if (isset($xmlRoot->{'many-to-many'})) {
|
||||
foreach ($xmlRoot->{'many-to-many'} as $manyToManyElement) {
|
||||
@ -340,11 +340,11 @@ class XmlDriver extends AbstractFileDriver
|
||||
'fieldName' => (string)$manyToManyElement['field'],
|
||||
'targetEntity' => (string)$manyToManyElement['target-entity']
|
||||
);
|
||||
|
||||
|
||||
if (isset($manyToManyElement['fetch'])) {
|
||||
$mapping['fetch'] = constant('Doctrine\ORM\Mapping\AssociationMapping::FETCH_' . (string)$manyToManyElement['fetch']);
|
||||
}
|
||||
|
||||
|
||||
if (isset($manyToManyElement['mapped-by'])) {
|
||||
$mapping['mappedBy'] = (string)$manyToManyElement['mapped-by'];
|
||||
} else if (isset($manyToManyElement->{'join-table'})) {
|
||||
@ -360,22 +360,22 @@ class XmlDriver extends AbstractFileDriver
|
||||
if (isset($joinTableElement['schema'])) {
|
||||
$joinTable['schema'] = (string)$joinTableElement['schema'];
|
||||
}
|
||||
|
||||
|
||||
foreach ($joinTableElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
|
||||
$joinTable['joinColumns'][] = $this->_getJoinColumnMapping($joinColumnElement);
|
||||
}
|
||||
|
||||
|
||||
foreach ($joinTableElement->{'inverse-join-columns'}->{'join-column'} as $joinColumnElement) {
|
||||
$joinTable['inverseJoinColumns'][] = $this->_getJoinColumnMapping($joinColumnElement);
|
||||
}
|
||||
|
||||
|
||||
$mapping['joinTable'] = $joinTable;
|
||||
}
|
||||
|
||||
|
||||
if (isset($manyToManyElement->cascade)) {
|
||||
$mapping['cascade'] = $this->_getCascadeMappings($manyToManyElement->cascade);
|
||||
}
|
||||
|
||||
|
||||
if (isset($manyToManyElement->{'orphan-removal'})) {
|
||||
$mapping['orphanRemoval'] = (bool)$manyToManyElement->{'orphan-removal'};
|
||||
}
|
||||
@ -387,7 +387,7 @@ class XmlDriver extends AbstractFileDriver
|
||||
}
|
||||
$mapping['orderBy'] = $orderBy;
|
||||
}
|
||||
|
||||
|
||||
$metadata->mapManyToMany($mapping);
|
||||
}
|
||||
}
|
||||
@ -403,7 +403,7 @@ class XmlDriver extends AbstractFileDriver
|
||||
/**
|
||||
* Constructs a joinColumn mapping array based on the information
|
||||
* found in the given SimpleXMLElement.
|
||||
*
|
||||
*
|
||||
* @param $joinColumnElement The XML element.
|
||||
* @return array The mapping array.
|
||||
*/
|
||||
@ -413,19 +413,19 @@ class XmlDriver extends AbstractFileDriver
|
||||
'name' => (string)$joinColumnElement['name'],
|
||||
'referencedColumnName' => (string)$joinColumnElement['referenced-column-name']
|
||||
);
|
||||
|
||||
|
||||
if (isset($joinColumnElement['unique'])) {
|
||||
$joinColumn['unique'] = ((string)$joinColumnElement['unique'] == "false") ? false : true;
|
||||
}
|
||||
|
||||
|
||||
if (isset($joinColumnElement['nullable'])) {
|
||||
$joinColumn['nullable'] = ((string)$joinColumnElement['nullable'] == "false") ? false : true;
|
||||
}
|
||||
|
||||
|
||||
if (isset($joinColumnElement['on-delete'])) {
|
||||
$joinColumn['onDelete'] = (string)$joinColumnElement['on-delete'];
|
||||
}
|
||||
|
||||
|
||||
if (isset($joinColumnElement['on-update'])) {
|
||||
$joinColumn['onUpdate'] = (string)$joinColumnElement['on-update'];
|
||||
}
|
||||
@ -433,13 +433,13 @@ class XmlDriver extends AbstractFileDriver
|
||||
if (isset($joinColumnElement['column-definition'])) {
|
||||
$joinColumn['columnDefinition'] = (string)$joinColumnElement['column-definition'];
|
||||
}
|
||||
|
||||
|
||||
return $joinColumn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gathers a list of cascade options found in the given cascade element.
|
||||
*
|
||||
*
|
||||
* @param $cascadeElement The cascade element.
|
||||
* @return array The list of cascade options.
|
||||
*/
|
||||
@ -456,7 +456,7 @@ class XmlDriver extends AbstractFileDriver
|
||||
}
|
||||
return $cascades;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@ -471,7 +471,7 @@ class XmlDriver extends AbstractFileDriver
|
||||
$result[$entityName] = $entityElement;
|
||||
}
|
||||
} else if (isset($xmlElement->{'mapped-superclass'})) {
|
||||
foreach ($xmlElement->{'mapped-superclass'} as $mapperSuperClass) {
|
||||
foreach ($xmlElement->{'mapped-superclass'} as $mappedSuperClass) {
|
||||
$className = (string)$mappedSuperClass['name'];
|
||||
$result[$className] = $mappedSuperClass;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user