php - Doctrine always only looks at the owning side of a bidirectional association for updates -
I know which side and the inverse side is the master, but I can not understand the following:
< Blockquote>Since the principle always looks for the owner of bidirectional collaboration for updates, it is not necessary to write that the inverse collection of bidirectional one-to-many or many-many associations has been updated. is. This knowledge can often be used to improve performance by avoiding the collection of derivative collections.
The following code is also from the doctor:
& lt; ? Php // This code is from DOC / Remove elements $ user- & gt; GetComments () - & gt; Remove Element ($ comment); $ Comment-> SetAuthor (zero); $ Em- & gt; Flush ();
So the above code is redundant? I can remove the association with the comment (owner) party:
// This is my code $ comment-> set is blank (empty); $ Em- & gt; Flush ();
Am I right? Or can you provide any examples? Thanks!
Edit:
I found great details of "placing a colleague for changes".
Also thanks AlixB, your answer is correct, as explained in the link given above.
This code is the correct flush for theory to update an area, comment from the theory database Will remove. But you need to think that some of the functions in the code can end later. So if you do not process the process of the bot and the busy side, then in your logic you will have a comment with a blank author, but in the list of any user's comments. For example, if you take this user back to the list of comments, then something wrong will happen to you.
Do you understand what I mean?
Comments
Post a Comment