Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change nodename and add new reference to collection. Fails with 409, PathNotFoundException. #703

Open
koemeet opened this issue Apr 18, 2016 · 3 comments

Comments

@koemeet
Copy link
Contributor

koemeet commented Apr 18, 2016

You cannot update the nodename of a document and add a new reference in the same transaction. To illustrate the issue better, I have the following code example:

$page = $dm->find(null, $object->getId());

$page->setName('helloo');

$translation = new PageTranslation();
$translation->setLocale('nl_NL');
$translation->setTitle('Over ons');
$translation->setBody('Content voor over ons');
$page->addTranslation($translation);

$dm->persist($page);
$dm->flush();

When running the above code, it will throw the following exception:

PHPCR\PathNotFoundException: HTTP 409: /workspaces/525/channels/658/pages/helloo/nl_NL

I am not sure if this is a problem in the phpcr-odm project or an issue with the jackalope-jackrabbit transport layer.

@dbu
Copy link
Member

dbu commented Apr 18, 2016

i think this is a problem of how references and renamings are handled inside the unit of work. it might also depend on order of execution. if you have time to look into this, i would be glad - i can't promise to find time to dig through that one.

btw, for your example, did you consider using the translation functionality of phpcr-odm itself? then you would not need PageTranslation objects and localization would happen completely transparent: http://doctrine-orm.readthedocs.org/projects/doctrine-phpcr-odm/en/latest/reference/multilang.html

@koemeet
Copy link
Contributor Author

koemeet commented Apr 18, 2016

When I find some more debug time I will try and find the issue, I was already looking in how the Jackalope client builds the request to the JCR repository, but I lack the understanding, so I need to know first how everything works. I will give it a try 👍

Well, I need to be able to load the translations of all locales in the same runtime, calls like $page->getTranslations() should work properly. Also I wanted a nice way to add new translations. This is the RFC/Proposal I am currently issuing for Sylius: Sylius/Sylius#4808

To achieve that with the translations system provided by doctrine phpcr-odm, it would require a lot of hacking to make a good public API to work with translations. The only downside with my approach, is that when you require one translation, all of them will be loaded in memory for that document. Or do you know a way to achieve some kind of extra lazy loading with phpcr?

@dbu
Copy link
Member

dbu commented Apr 19, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants