-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix loading references if mapped by uuid and not by id. #36
Fix loading references if mapped by uuid and not by id. #36
Conversation
DocumentManager::getReference() does not work correctly if called with an uuid instead of an id, so if we have an uuid here, we have to fetch the node first (which unfortunately is not optimal from a performance point of view) to get the correct id of the document. (DocumentManager::getReference() seems to work first - but it will initialize the id field with the uuid and this will cause errors later, e.g. when accessing other referenced documents of the loaded document - it is simply not possible to use it correctly with an uuid)
@ElectricMaxxx This is related to doctrine/phpcr-odm#493 am I right? |
Exactly. Maybe @dbu can help with that?
|
@joschi127 I used to use the branch of the PR mentioned above and there it works to reference a node by its uuid, but didn't find the time wrap that one up and clean it. So what would be better? Clean up the PR in the phpcr-odm or merge this one here? |
@ElectricMaxxx Well at least one of them should be merged because otherwise things are broken ;-) If it would be possible to clean up the PR in phpcr-odm and get it merged, it would be the preferred solution from my point of view, because this PR here works fine, but it causes an additional DB query which already happens when the proxy is created, so we kind of loose the advantages of the proxy to lazy load the referenced document and not do a DB query as long as the referenced document is not being used. Do you think you can find some time to look at the phpcr-odm PR again? Can I help seomehow, for example by testing it? |
@ElectricMaxxx hmm... what do you think? Maybe this one should be merged, so at least things are not broken? |
Sorry i didn't get into this repo for month. Will try to tonight.
|
looks fine to me. Thanks. I think i need to start writing tests for the UoW in here :-( |
Fix loading references if mapped by uuid and not by id.
Thanks :-) |
DocumentManager::getReference() does not work correctly if called with an uuid instead of an id,
so if we have an uuid here, we have to fetch the node first (which unfortunately is not optimal
from a performance point of view) to get the correct id of the document.
(DocumentManager::getReference() seems to work first - but it will initialize the id field with the
uuid and this will cause errors later, e.g. when accessing other referenced documents of the loaded
document - it is simply not possible to use it correctly with an uuid)
Am I right?
Is there a correct way to get a proxy class for a document when you only know the uuid and not the id? Unfortunately I could not find a way to do it. (I am using jackalope-doctrine-dbal)
Let's check and discuss if there is a better solution. :-)