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-3079: preUpdate in EntityListener not run in transaction #3852

Closed
doctrinebot opened this issue Apr 10, 2014 · 2 comments
Closed

DDC-3079: preUpdate in EntityListener not run in transaction #3852

doctrinebot opened this issue Apr 10, 2014 · 2 comments
Assignees
Labels

Comments

@doctrinebot
Copy link

Jira issue originally created by user jirin:

I have entity:

class Article{
    /****
     * @ORM\OneToMany(targetEntity = "ArticleModule\Model\Entities\ArticlePhoto", mappedBy = "article", cascade = {"persist", "remove"}, orphanRemoval = TRUE)
     * @ORM\OrderBy({"sequence" = "ASC"})
     */
    protected $articlePhotos;
}

And Entity Listener with preRemove.

I call

$article->articlePhotos->clear();
...some changes with entity...
$em->flush();

preRemove in Entity Listener is called, BUT before Begin transaction...

I can do
$em->transactional(function(){}); then it's full in transaction..

@doctrinebot
Copy link
Author

Comment created by @Ocramius:

As of https://github.com/doctrine/doctrine2/blob/ff801879304dfc2bdec34222d4c03fa7bde3e4e4/lib/Doctrine/ORM/UnitOfWork.php#L344, I see that preUpdate listeners are executed AFTER the transaction has been started.

Marking as invalid

@doctrinebot
Copy link
Author

Issue was closed with resolution "Invalid"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants