DDC-394: Enable method chaining on EntityManager::persist #487

Closed
opened 2026-01-22 12:40:12 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 8, 2010).

Jira issue originally created by user seldaek:

Please allow method chaining on persist so you can do:

$em->persist($foo)
->persist($bar)
->flush();

Patch is there:
http://dump.seld.be/D2-persist_return.patch

Originally created by @doctrinebot on GitHub (Mar 8, 2010). Jira issue originally created by user seldaek: Please allow method chaining on persist so you can do: $em->persist($foo) ->persist($bar) ->flush(); Patch is there: http://dump.seld.be/D2-persist_return.patch
admin added the Improvement label 2026-01-22 12:40:12 +01:00
admin closed this issue 2026-01-22 12:40:12 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 8, 2010):

Comment created by romanb:

I dont see any good reason to do this. The EntityManager API is not meant to be a fluent API. There are methods with different return values (merge cant return $this). It does not create some kind of DSL or whatever. Fluent interface just for the sake of saving a few keystrokes, without any actual improvements of API readability or conciseness is abuse and a bad application of a fluent interface.

@doctrinebot commented on GitHub (Mar 8, 2010): Comment created by romanb: I dont see any good reason to do this. The EntityManager API is not meant to be a fluent API. There are methods with different return values (merge cant return $this). It does not create some kind of DSL or whatever. Fluent interface just for the sake of saving a few keystrokes, without any actual improvements of API readability or conciseness is abuse and a bad application of a fluent interface.
Author
Owner

@doctrinebot commented on GitHub (Mar 8, 2010):

Issue was closed with resolution "Won't Fix"

@doctrinebot commented on GitHub (Mar 8, 2010): Issue was closed with resolution "Won't Fix"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#487