mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-266: Example for removing objects by value from a collection is wrong or ambiguous #330
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jan 22, 2010).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user bmills:
Under the section about removing associated objects from a collection (Working With Objects), there should be special mention made to distinguish between the remove($key) and removeElement($element) methods in ArrayCollection.
The current example is ambiguous and may indicate that elements (objects) can be removed via the remove() method:
// Article <- one-to-many -> Comment
$article->getComments()->remove($comment);
Passing an object instead of a key into remove() causes a fatal error. Using removeElement($comment) in the example would make more sense.
Thanks!
@doctrinebot commented on GitHub (Feb 7, 2010):
Comment created by @beberlei:
Fixed
@doctrinebot commented on GitHub (Feb 7, 2010):
Issue was closed with resolution "Fixed"