1
0
mirror of synced 2024-12-13 22:56:04 +03:00

Add support for custom ID generator in Yaml driver

This commit is contained in:
Vitali Yakavenka 2011-11-28 22:01:55 +03:00
parent 0a4fbc9770
commit 84086915e4
2 changed files with 15 additions and 1 deletions

View File

@ -191,6 +191,12 @@ class YamlDriver extends AbstractFileDriver
// Check for SequenceGenerator/TableGenerator definition
if (isset($idElement['sequenceGenerator'])) {
$metadata->setSequenceGeneratorDefinition($idElement['sequenceGenerator']);
} else if (isset($idElement['customIdGenerator'])) {
$customGenerator = $idElement['customIdGenerator'];
$metadata->setCustomGeneratorDefinition(array(
'class' => (string) $customGenerator['class'],
'args' => $customGenerator['args']
));
} else if (isset($idElement['tableGenerator'])) {
throw MappingException::tableIdGeneratorNotImplemented($className);
}

View File

@ -3,4 +3,12 @@ Doctrine\Tests\ORM\Mapping\Animal:
inheritanceType: SINGLE_TABLE
discriminatorMap:
cat: Cat
dog: Dog
dog: Dog
id:
id:
type: integer
generator:
strategy: CUSTOM
customIdGenerator:
class: stdClass
args: [ par1, par2 ]