[2.0] Updating YAML driver with missing elements from XML driver.
This commit is contained in:
parent
05d5fe4954
commit
27356225dd
@ -67,7 +67,7 @@ class XmlDriver extends AbstractFileDriver
|
|||||||
// Evaluate <unique-constraints..>
|
// Evaluate <unique-constraints..>
|
||||||
if (isset($xmlRoot->{'unique-constraints'})) {
|
if (isset($xmlRoot->{'unique-constraints'})) {
|
||||||
foreach ($xmlRoot->{'unique-constraints'}->{'unique-constraint'} as $unique) {
|
foreach ($xmlRoot->{'unique-constraints'}->{'unique-constraint'} as $unique) {
|
||||||
$metadata->primaryTable['uniqueConstraints'][] = explode(',', $index['columns']);
|
$metadata->primaryTable['uniqueConstraints'][] = explode(',', $unique['columns']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,6 +173,9 @@ class XmlDriver extends AbstractFileDriver
|
|||||||
$joinColumns[] = $this->_getJoinColumnMapping($manyToOneElement->{'join-column'});
|
$joinColumns[] = $this->_getJoinColumnMapping($manyToOneElement->{'join-column'});
|
||||||
} else if (isset($manyToOneElement->{'join-columns'})) {
|
} else if (isset($manyToOneElement->{'join-columns'})) {
|
||||||
foreach ($manyToOneElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
|
foreach ($manyToOneElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
|
||||||
|
if (!isset($joinColumnElement['name'])) {
|
||||||
|
$joinColumnElement['name'] = $name;
|
||||||
|
}
|
||||||
$joinColumns[] = $this->_getJoinColumnMapping($joinColumnElement);
|
$joinColumns[] = $this->_getJoinColumnMapping($joinColumnElement);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -57,6 +57,21 @@ class YamlDriver extends AbstractFileDriver
|
|||||||
$metadata->setInheritanceType($element['inheritanceType']);
|
$metadata->setInheritanceType($element['inheritanceType']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Evaluate indexes
|
||||||
|
if (isset($element['indexes'])) {
|
||||||
|
foreach ($element['indexes'] as $index) {
|
||||||
|
$metadata->primaryTable['indexes'][$index['name']] = array('fields' =>
|
||||||
|
explode(',', $index['columns']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Evaluate uniqueConstraints
|
||||||
|
if (isset($element['uniqueConstraints'])) {
|
||||||
|
foreach ($element['uniqueConstraints'] as $unique) {
|
||||||
|
$metadata->primaryTable['uniqueConstraints'][] = explode(',', $unique['columns']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Evaluate fields
|
// Evaluate fields
|
||||||
if (isset($element['fields'])) {
|
if (isset($element['fields'])) {
|
||||||
foreach ($element['fields'] as $name => $fieldMapping) {
|
foreach ($element['fields'] as $name => $fieldMapping) {
|
||||||
@ -70,6 +85,12 @@ class YamlDriver extends AbstractFileDriver
|
|||||||
if (isset($fieldMapping['length'])) {
|
if (isset($fieldMapping['length'])) {
|
||||||
$mapping['length'] = $fieldMapping['length'];
|
$mapping['length'] = $fieldMapping['length'];
|
||||||
}
|
}
|
||||||
|
if (isset($fieldMapping['precision'])) {
|
||||||
|
$mapping['precision'] = $fieldMapping['precision'];
|
||||||
|
}
|
||||||
|
if (isset($fieldMapping['scale'])) {
|
||||||
|
$mapping['scale'] = $fieldMapping['scale'];
|
||||||
|
}
|
||||||
if (isset($fieldMapping['version']) && $fieldMapping['version']) {
|
if (isset($fieldMapping['version']) && $fieldMapping['version']) {
|
||||||
$metadata->setVersionMapping($mapping);
|
$metadata->setVersionMapping($mapping);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user