[PHPCR-42] sync the xml/yml mapping driver with the annotation driver Created: 25/Jan/12  Updated: 17/Aug/12  Resolved: 17/Aug/12

Status: Resolved
Project: Doctrine PHPCR
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Lukas Kahwe Assignee: Lukas Kahwe
Resolution: Fixed Votes: 0
Labels: None


 Description   

especially the locale/version stuff is not yet supported. but also the reference mapping seems to look quite different.



 Comments   
Comment by David Buchmann [ 02/Feb/12 ]

versioning is done now: https://github.com/doctrine/phpcr-odm/pull/96

but we miss tests for the non-annotation mappings

Comment by David Buchmann [ 07/Feb/12 ]

how to proceed:

Comment by David Buchmann [ 13/Feb/12 ]

initial test for annotations is added here, please evolve from this
https://github.com/doctrine/phpcr-odm/commit/38f8bbc8b655aafd099287e18401248c44b40492

Comment by Luis Cordova [ 15/Apr/12 ]

hi dbu, lsmith, i gave thought to this and did some corrections https://github.com/doctrine/phpcr-odm/pull/133

however I am totally disoriented as i see two Mapping folders as follows:

1. https://github.com/doctrine/phpcr-odm/tree/master/tests/Doctrine/Tests/ODM/PHPCR/Functional/Mapping
There is only 1 class here with a TODO which i found not very clear about what to do next

2. https://github.com/doctrine/phpcr-odm/tree/master/tests/Doctrine/Tests/ODM/PHPCR/Mapping
These set of classes was already refactored by someone else before I came in and I guess the work is done

I check the coverage as you said on the annotation driver class so it basically lacks the lifecycle callbacks usage, but where to put these tests in as i am confused


160 0 : if ($annot instanceof ODM\PrePersist) { 161 0 : $metadata->addLifecycleCallback($method->getName(), Event::prePersist); 162 0 : } elseif ($annot instanceof ODM\PostPersist) { 163 0 : $metadata->addLifecycleCallback($method->getName(), Event::postPersist); 164 0 : } elseif ($annot instanceof ODM\PreUpdate) { 165 0 : $metadata->addLifecycleCallback($method->getName(), Event::preUpdate); 166 0 : } elseif ($annot instanceof ODM\PostUpdate) { 167 0 : $metadata->addLifecycleCallback($method->getName(), Event::postUpdate); 168 0 : } elseif ($annot instanceof ODM\PreRemove) { 169 0 : $metadata->addLifecycleCallback($method->getName(), Event::preRemove); 170 0 : } elseif ($annot instanceof ODM\PostRemove) { 171 0 : $metadata->addLifecycleCallback($method->getName(), Event::postRemove); 172 0 : } elseif ($annot instanceof ODM\PostLoad) { 173 0 : $metadata->addLifecycleCallback($method->getName(), Event::postLoad); 174 0 : }

Also i am not very familiar with the schema of the annotation driver how to test so any explanation or help pointers would be great, thanks

Comment by Luis Cordova [ 15/Apr/12 ]

I am so not using jira sorry guys, ---> https://github.com/doctrine/phpcr-odm/pull/133

Comment by David Buchmann [ 09/Jun/12 ]

@craigmarvelley started working on this, promised a pull request soon

Comment by Craig Marvelley [ 11/Jun/12 ]

I've opened a PR here, there's still a bit left to be done that I'm hoping to add in the next few days.

https://github.com/doctrine/phpcr-odm/pull/144

Comment by David Buchmann [ 20/Jun/12 ]

the pull request by craig has meanwhile been merged.

there is still a bit of issues:

the driver looks for the non-namespaced file. i.e. No mapping file found named '/home/david/liip/symfony-cmf/cmf-sandbox/vendor/symfony-cmf/routing-extra-bundle/Symfony/Cmf/Bundle/RoutingExtraBundle/Resources/config/doctrine/Route.phpcr.xml' for class 'Symfony\Cmf\Bundle\RoutingExtraBundle\Document\Route'.

but if i put that file there and have an error, he tells me Invalid mapping file 'Symfony.Cmf.Bundle.RoutingExtraBundle.Document.Route.phpcr.xml'

so the name determiner seems to be off a bit

Comment by David Buchmann [ 18/Jul/12 ]

also, the mapped superclass feature makes no sense with phpcr-odm, we can simply inherit from document classes.

Comment by David Buchmann [ 20/Jul/12 ]

actually mapped superclass seems to be relevant, but i did not yet understand it and the doc about it should be updated. see discussion in https://github.com/doctrine/phpcr-odm/pull/144#issuecomment-7095570

Comment by Lukas Kahwe [ 17/Aug/12 ]

seems to me like reference/referrer/translation/versioning is all done .. so if there is anything left .. please open a new ticket

Generated at Fri Jul 25 06:57:24 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.