Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
doctrinebot opened this issue Nov 7, 2013 · 8 comments
Closed

Comments

@doctrinebot
Copy link

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?

@doctrinebot
Copy link
Author

Comment created by stof:

I agree that this makes the method hard to use. And I don't undertstand why it would replace the return value.

What was the intention for this Benjamin ?

@doctrinebot
Copy link
Author

Comment created by @guilhermeblanco:

[stof] [beberlei] I'm considering to remove the ternary and always return the callback result.
What do you think? It seems like a minor BC break, but would like to get more feedback around this.

@doctrinebot
Copy link
Author

Comment created by @Ocramius:

[~guilhermeblanco] this was already refused before because of the BC break.

@fracz
Copy link

fracz commented Nov 28, 2016

Is there any chance to change this strange behavior?

@Majkl578
Copy link
Contributor

@fracz Yes, it's aready been done for 3.0 in #6147.
Ping @Ocramius, this could be marked as BC break & done & 3.0 milestone, I guess?

@lcobucci
Copy link
Member

@fracz did you see #6147?

@fracz
Copy link

fracz commented Nov 28, 2016

I have not. Thank you for rapid response!

@Ocramius Ocramius added this to the 2.6.0 milestone Nov 29, 2016
@Ocramius Ocramius assigned Ocramius and unassigned beberlei Nov 29, 2016
@Ocramius Ocramius changed the title DDC-2783: EntityManager::transactional empty values as true DDC-2783: EntityManager#transactional() support for non-truthy values Nov 29, 2016
@Ocramius
Copy link
Member

Closing as per #6147 👍

@lcobucci lcobucci modified the milestones: 2.6.0, 3.0 Dec 19, 2017
@greg0ire greg0ire removed this from the 3.0.0 milestone Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants