DDC-2783: EntityManager#transactional() support for non-truthy values #3478

Open
opened 2026-01-22 14:20:38 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Nov 7, 2013).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user chebba:

The problem:
Any response from transactional callback which is evaluated to *false* (empty array, empty string, 0, null, etc) becomes true

$return = call*user*func($func, $this);

$this->flush();
$this->conn->commit();

return $return ?: true;

There is the old resolved issue DDC-1336, which describes this behavior.
@return tag is clear now.

@return mixed Returns the non-empty value returned from the closure or true instead

But this logic is blowing mind and leading to unexpectable results. The expected behavior is just return callback result, i don't see any good use cases for current implementation.

It requires a BC break. Can the deprecation process be started to change this behaviour in few major releases?

Originally created by @doctrinebot on GitHub (Nov 7, 2013). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user chebba: The problem: Any response from transactional callback which is evaluated to **false\* (empty array, empty string, 0, null, etc) becomes *true** ``` $return = call*user*func($func, $this); $this->flush(); $this->conn->commit(); return $return ?: true; ``` There is the old resolved issue [DDC-1336](http://www.doctrine-project.org/jira/browse/DDC-1336), which describes this behavior. `@return` tag is clear now. ``` @return mixed Returns the non-empty value returned from the closure or true instead ``` But this logic is blowing mind and leading to unexpectable results. The expected behavior is just return callback result, i don't see any good use cases for current implementation. It requires a BC break. Can the deprecation process be started to change this behaviour in few major releases?
admin added the ImprovementBC Break labels 2026-01-22 14:20:38 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3478