mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-2918: get statements from ORM #3632
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jan 15, 2014).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user flip101:
When doing
persist()and thenflush()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.
https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php#L260
Benefit:
When having access to the statements afterwards, all the following methods would be available:
http://www.php.net/manual/en/class.pdostatement.php
Most interesting are rowCount and error related methods.
@doctrinebot commented on GitHub (Jan 15, 2014):
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
@doctrinebot commented on GitHub (Jan 15, 2014):
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 ..