DDC-2918: get statements from ORM #3677

doctrinebot opened this Issue Jan 15, 2014 · 2 comments

2 participants


Jira issue originally created by user flip101:

When doing persist() and then flush() the statements are not accessible anymore after the operation is done.

The EntityManager uses an EntityPersister. When looking at the BasicEntityPersister->executeInserts() a new statement is created but it's not saved as part of another object.

When having access to the statements afterwards, all the following methods would be available:

Most interesting are rowCount and error related methods.


Comment created by @deeky666:

[~flip101] AFAIK you can use an SQL Logger for this which has to be set in the connection. The ORM testsuite makes use of this, too. See this example: https://github.com/doctrine/doctrine2/blob/master/tests/Doctrine/Tests/ORM/Functional/OneToOneEagerLoadingTest.php#L155


Comment created by flip101:

Yes sure, but using a logger will be a strange way to pipe it back into business logic.

For example it's possible to do remove() on a proxy so you don't know if the row was present or not.

or another situation ..

when dealing with concurrency .. somebody else might have deleted the row already ..

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment