Closed korhov closed 8 years ago
See my comment on the commit where you already asked for it. Changing this code would be wrong because of the way readOnly
works in the ORM. An entity marked with this flag is not tracked for updates anymore but it is still possible to insert or delete rows. The right name for this feature would have been immutable
, but it is too late to change it.
this feature was not meant to represent DB views.
@stof I think you refer to my closed PR #184 from March :) Anyways, I still rely on this purger "fix" myself, because we did not find another solution to exclude views from purging yet =(.
We need a way to exclude tables from being purged. Any ideas?
+1
There is no check for annotaion in purge method If You try to purge on view() you will still get the exception:
[Doctrine\DBAL\Exception\DriverException]
An exception occurred while executing 'DELETE FROM orders_derived':
SQLSTATE[HY000]: General error: 1288 The target table orders_derived of the DELETE is not updatable
+1
I use the filter schema expression from the DBAL connection. See Add ability to exclude tables from purge in ORM
Hmm any solution for this ? Or just close ?
@tarlepp the use of the filter schema expression in the DBAL connection seems to me like the feature you are looking for as YaOcelotl explained.
@mikeSimonson this example should be in the docs...
@tarlepp I will happilly merge the PR to the docs
I have code in my Entity: Doctrine\ORM\Mapping\Entity(readOnly=true)
I get an error: Doctrine\DBAL\DBALException: An exception occurred while executing 'DELETE FROM table':
I think, you should add
in https://github.com/doctrine/data-fixtures/blob/2f180a477fca73232d2143ddc9f10c9e3e8d508d/lib/Doctrine/Common/DataFixtures/Purger/ORMPurger.php#L123 to selected condition