-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Refactored docs to use adders/removers #2434
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
Conversation
The code is tested on 2.1 and it works. I have one question though. There is a note that says:
I tested it with Doctrine 2.3.1 and I got no error. |
@wouterj Are you adding new elements in the collection or only editing exsting ones ? |
And are you cascading the persist on the relation ? If yes, it is indeed useless to persist explicitly each tag |
{ | ||
// ... | ||
|
||
public function addTag($tag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to define both addTag
and removeTag
. If one of them is missing, the setter for the collection will be used when using by_reference => false
, not the adder and remover for each element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Ping @wouterj! I'm waiting for answers on Stof's questions before moving on :) |
Sorry for my delay on this. I need to finish some PRs now! :) @stof was correct, the entity I used was cascading the persist action. (I just used your entity, so I wasn't aware of that) |
@weaverryan I've updated the article, I think it's ready now |
Refactored docs to use adders/removers
This is the first draw to fix this document for 2.1. I have not tested the code yet, that's why I called it a WIP.