Skip to content

Loading…

DDC-554: Sequence Names in XML Driver #5062

Closed
doctrinebot opened this Issue · 1 comment

2 participants

@doctrinebot

Jira issue originally created by user @beberlei:

Hi all,

I'm working with Doctrine 2.0 ALPHA 4 on Opensolaris with PHP 5.3 and Postgresql 8.3.

When specifiying a sequence name in xml mapping file, Doctrine doesn't seems to use it. After debugging time, i found in ORM/Mapping/Driver/XmlDriver.php on line 193 :

            // Check for SequenceGenerator/TableGenerator definition
            if (isset($idElement->{'sequence-generator'})) {
                $seqGenerator = $idElement->{'sequence-generator'};
                $metadata->setSequenceGeneratorDefinition(array(
                    'sequenceName' => $seqGenerator->{'sequence-name'},
                    'allocationSize' => $seqGenerator->{'allocation-size'},
                    'initialValue' => $seqGeneratorAnnot->{'initial-value'}
                ));
            } else if (isset($idElement->{'table-generator'})) {
                throw MappingException::tableIdGeneratorNotImplemented($className);
            }

Obviously $seqGenerator->{'sequence-name'} return void things, even if xml file is correct. So i decided to replace it with : $seqGenerator['sequence-name']

            // Check for SequenceGenerator/TableGenerator definition
            if (isset($idElement->{'sequence-generator'})) {
                $seqGenerator = $idElement->{'sequence-generator'};
                $metadata->setSequenceGeneratorDefinition(array(
                    'sequenceName' => (string)$seqGenerator['sequence-name'],
                    'allocationSize' => (string)$seqGenerator['allocation-size'],
                    'initialValue' => (string)$seqGeneratorAnnot['initial-value']
                ));
            } else if (isset($idElement->{'table-generator'})) {
                throw MappingException::tableIdGeneratorNotImplemented($className);
            }

Hope it will be usefull.

Paul Fariello

@doctrinebot

Issue was closed with resolution "Fixed"

@jwage jwage was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.0-BETA2 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.