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

DDC-2531: ManyToManyPersister does not take Custom Types into account #3255

Open
doctrinebot opened this issue Jun 26, 2013 · 1 comment
Open
Assignees
Labels

Comments

@doctrinebot
Copy link

Jira issue originally created by user georgevanvliet:

When two entities, both using a custom type for the "@id" column, have a "@manytomany" (bidirectional) relationship, the ManyToManyPersister does not take into account the custom type of the referenced id columns and therefore does not convert the values using the appropriate "convertToDatabaseValue" function.

The entities themselves are saved propery, but the insertion into the join table always fails.

@doctrinebot
Copy link
Author

Comment created by bgetsug:

My scenario:

  • EntityA uses a custom type for its @id column (specifically so I can store UUIDs in a binary column...see DDC-3721)
  • EntityA has a (unidirectional) many-to-many association with EntityB, and the usual ArrayCollection initialization on the property
  • I clear the entire collection by calling ArrayCollection::clear()
  • I call EntityManager::flush()
  • No errors occur, but no rows actually get deleted from the database.

Through debugging, I found that ManyToManyPersister::getDeleteSQL() does not handle custom types like ManyToManyPersister::getDeleteRowSQL() or ManyToManyPersister::removeElement(). So the proper SQL DELETE statement doesn't get executed.

My current workaround is to loop through my collection of EntityB, calling ArrayCollection::removeElement() with each entity. Given the complexity of ManyToManyPersister, I'm a bit leery of attempting a fix and submitting a PR, but at least wanted to document my issue here.

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

No branches or pull requests

2 participants