mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-36: EntityManager#persist should accept more objects to easily persist multiple objects. #45
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 (Oct 8, 2009).
Jira issue originally created by user marijn:
I think it would be nice if the persist function would accept more objects as an arguments by using
func-get-argsee the simple example below:\
@doctrinebot commented on GitHub (Oct 8, 2009):
Comment created by romanb:
I really dislike func_get_args in general because it makes parameters invisible on the public API without explicit correcting documentation (and grabbing parameters out of thin air, which is what func_get_args() does, doesnt look very appealing in the code, too).
Combined with the fact that this would really be only a very small convenience, I have to say no on this one. Sorry, but thanks for the suggestion.
What would probably be acceptable is: EntityManager#persistAll(array $entities) but then we would need such a method for remove/merge/detach as well. Sounds like too many new methods for me that will be rather rarely used and we dont want to bloat the public API like that. And it really is a one-liner in userland code:
foreach ($entities as $entity) $em->persist($entity);@doctrinebot commented on GitHub (Oct 8, 2009):
Issue was closed with resolution "Won't Fix"
@doctrinebot commented on GitHub (Oct 8, 2009):
Comment created by marijn:
Hi Roman,
I agree with you in keeping the API as clean as possible, its one of the most important features is you ask me from doctrine 2, that's why I'll have to agree with you.
Thanks for concidering.