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

add support for uuid in phpcr_document #103

Open
dbu opened this issue Dec 16, 2013 · 5 comments
Open

add support for uuid in phpcr_document #103

dbu opened this issue Dec 16, 2013 · 5 comments

Comments

@dbu
Copy link
Member

dbu commented Dec 16, 2013

the form type phpcr_document uses the "id" which is the phpcr path. it would be nice if optionally it could also use the uuid instead.

looking at Doctrine\Bundle\PHPCRBundle\Form\Type\DocumentType and its base class and PhpcrOdmQueryBuilderLoader i don't even see who or what determines the id.

Some discussion can be found in #147

@dantleech
Copy link
Contributor

@koemeet
Copy link

koemeet commented Nov 20, 2015

I might have an idea on how to solve this. In the PhpcrOdmQueryBuilderLoader we can just return this: $this->manager->findMany(null, $values)->toArray() in the getEntitiesByIds method. Now, the choices can be loaded. But you still need to alter the IdReader since it will now compare the id with the passed uuid, right. So if we use a custom IdReader for the DocumentType where you return the proper ID value in the getIdValue method, you can use uuids!

How is this solution? I currently implemented it this way for my own project. But maybe this could be used for this project. What are you thoughts @dbu @dantleech ?

@dbu
Copy link
Member Author

dbu commented Nov 22, 2015

i am not sure i completely understood your proposal. would i tell the form type whether i want uuid or path? or do both work mixed? what if a document is not referenceable (aka has no uuid)?
as long as there are no horrible hacks involved, i am very happy for a pull request to implement that. i guess the PR will also make it easier to discuss how it works.

important would be to have a test that demonstrates both modes work. do you want to do a pull request and we further discuss there?

@koemeet
Copy link

koemeet commented Nov 22, 2015

@dbu This would require to update symfony/doctrine-bridge to min. 2.7, since in that version they introduced the IdReader. Would this be acceptable?

@koemeet
Copy link

koemeet commented Nov 22, 2015

@dbu I made a PR (#236) with the idea I described, it would be the best if we could use the UUIDHelper::isUUID somehow to dynamically change the idField. Now I just check if its a referencable document, then it uses uuid.

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

No branches or pull requests

3 participants