1
0
mirror of synced 2024-12-13 06:46:03 +03:00

[2.0] Updating YAML driver with missing elements from XML driver.

This commit is contained in:
jwage 2009-08-24 18:33:59 +00:00
parent 05d5fe4954
commit 27356225dd
2 changed files with 25 additions and 1 deletions

View File

@ -67,7 +67,7 @@ class XmlDriver extends AbstractFileDriver
// Evaluate <unique-constraints..>
if (isset($xmlRoot->{'unique-constraints'})) {
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'});
} else if (isset($manyToOneElement->{'join-columns'})) {
foreach ($manyToOneElement->{'join-columns'}->{'join-column'} as $joinColumnElement) {
if (!isset($joinColumnElement['name'])) {
$joinColumnElement['name'] = $name;
}
$joinColumns[] = $this->_getJoinColumnMapping($joinColumnElement);
}
} else {

View File

@ -57,6 +57,21 @@ class YamlDriver extends AbstractFileDriver
$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
if (isset($element['fields'])) {
foreach ($element['fields'] as $name => $fieldMapping) {
@ -70,6 +85,12 @@ class YamlDriver extends AbstractFileDriver
if (isset($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']) {
$metadata->setVersionMapping($mapping);
}