-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[References] Adding the ReferencesListener breaks all other Doctrine extensions. #821
Comments
I think it could be related to the circular reference between the ORM and the MongoDB managers (through the 2 listeners). If it is, it would be fixed by refactoring the extensions to use manager registries instead of managers directly, as I suggested when implementing the extension at first. |
Ok thank you. That's probably what's going on. I tried searching for examples where people had both References and something else working at the same time but didn't find anything that wasn't a custom fork. It's beyond my skill level to fix unfortunately. |
@stof what do you mean by manager registries? Are they supported in 2.2 or starting from 2.3 orm? |
@l3pp4rd https://github.com/doctrine/common/blob/master/lib/Doctrine/Common/Persistence/ManagerRegistry.php |
@stof thanks, that is the way it should be done in general. Will need to schedule an update |
I think the I tried the configs provided as solution by @nifr and @borovan but still I get the error. |
@webdevilopers the circular reference is the main reason why I asked to use the ManagerRegistry instead |
Thanks @stof . Where can I get the fix - in dev-master then? At the moment I still use |
@stof Is this issue still open? Might have time to work on it if needed. |
well it is still open, maybe there is something related to that in #764 should be copied if applicable. That branch has too many changes, decided to keep BC since I do not have that much time.. cheers |
In fact I refactored it so that it now uses registries instead of managers, but I was also going to add phpcr to References, though I don't know if it's better to add it to 3.0. |
please do it in master if you are in need of such behavior the 3.0 is hardly going into master any time soon.. cheers |
@gonzalovilaseca would you mind to share you work before PR? This issue causing so much pain for years. |
will try to manage it for next minor release version.. |
Hi - so I've been using Tree, Blameable and Timestampable with no problems at all. I've recently had a need for the ORM/ODM cross-relational functionality, so added in the ReferencesListener, and although it works fine none of the other extensions work at the same time.
Blame and Timestamp both just insert null values now, and Tree gives me the error "Tree listener was not found on your entity manager, it must be hooked into the event manager".
I've done a var_dump in the Gedmo\Tree\Entity\Repository\AbstractTreeRepository code and it seems that whenever this line (from my services.yml) is called
then $em->getListeners() returns an empty array. No exceptions are thrown, just the other extensions fail to work. If I comment out that one line, the situation is reversed (Everything works apart from references).
I've tried with and without Stof, nothing changes. I've tried injecting the entity managers in the constructor, that doesn't work either. I've also tried with just one listener where I pass in 2 entity managers. I've included the relevant bit of services.yml below.
Thanks,
Adam
The text was updated successfully, but these errors were encountered: