#1204 - refactored sequence-generator metadata exporting into own private method for simplicity
This commit is contained in:
parent
aa1454562c
commit
ce308dc476
1 changed files with 25 additions and 6 deletions
|
@ -171,12 +171,8 @@ class XmlExporter extends AbstractExporter
|
||||||
if ($idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) {
|
if ($idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) {
|
||||||
$generatorXml = $idXml->addChild('generator');
|
$generatorXml = $idXml->addChild('generator');
|
||||||
$generatorXml->addAttribute('strategy', $idGeneratorType);
|
$generatorXml->addAttribute('strategy', $idGeneratorType);
|
||||||
if($metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE && $metadata->sequenceGeneratorDefinition) {
|
|
||||||
$sequenceGeneratorXml = $idXml->addChild('sequence-generator');
|
$this->exportSequenceInformation($idXml, $metadata);
|
||||||
$sequenceGeneratorXml->addAttribute('sequence-name', $metadata->sequenceGeneratorDefinition['sequenceName']);
|
|
||||||
$sequenceGeneratorXml->addAttribute('allocation-size', $metadata->sequenceGeneratorDefinition['allocationSize']);
|
|
||||||
$sequenceGeneratorXml->addAttribute('initial-value', $metadata->sequenceGeneratorDefinition['initialValue']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,6 +413,29 @@ class XmlExporter extends AbstractExporter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Export sequence information (if available/configured) into the current identifier XML node
|
||||||
|
*
|
||||||
|
* @param \SimpleXMLElement $identifierXmlNode
|
||||||
|
* @param ClassMetadataInfo $metadata
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function exportSequenceInformation(\SimpleXMLElement $identifierXmlNode, ClassMetadataInfo $metadata)
|
||||||
|
{
|
||||||
|
$sequenceDefinition = $metadata->sequenceGeneratorDefinition;
|
||||||
|
|
||||||
|
if (! ($metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE && $sequenceDefinition)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sequenceGeneratorXml = $identifierXmlNode->addChild('sequence-generator');
|
||||||
|
|
||||||
|
$sequenceGeneratorXml->addAttribute('sequence-name', $sequenceDefinition['sequenceName']);
|
||||||
|
$sequenceGeneratorXml->addAttribute('allocation-size', $sequenceDefinition['allocationSize']);
|
||||||
|
$sequenceGeneratorXml->addAttribute('initial-value', $sequenceDefinition['initialValue']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \SimpleXMLElement $simpleXml
|
* @param \SimpleXMLElement $simpleXml
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue