doctrine / data-fixtures

Doctrine2 ORM Data Fixtures Extensions
http://www.doctrine-project.org
MIT License
2.78k stars 224 forks source link

Make sure entities that are marked readOnly are excluded from purge #242

Closed dhaarbrink closed 8 years ago

dhaarbrink commented 8 years ago

In my case this entity is implemented as a view, DELETE or TRUNCATE won't work. Whatever the case, readOnly implies no changing the data.

mikeSimonson commented 8 years ago

@dhaarbrink Well the issue here is that apparently the readonly entities were not implemented to represent views. Don't know how the view should be represented nor how they should be treated by the data-fixture.

The easiest is probably to put those readonly entities (views) on a different connection/entity manager. So that they are not touched by purge at all.

YaoOcelotl commented 8 years ago

I use the filter schema expression from the DBAL connection. See Add ability to exclude tables from purge in ORM

# Doctrine Configuration
doctrine:
    dbal:
        schema_filter: ~^(?!view)~
dhaarbrink commented 8 years ago

@YaoOcelotl thanks for the tip. Sadly it isn't released yet, but I did that myself now. This was indeed what I needed, I will close this PR.