doctrine / data-fixtures

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

Idea: default behavior in annotation #220

Open Adam314 opened 8 years ago

Adam314 commented 8 years ago

Many people ask how to selectively purge some entities or how to control purging-appending behavior. Why don't we add an annotation support in entities like this (notice the new fixtures mapping):

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\DataFixtures\Mapping as Fixture;
/**
 * @ORM\Table()
 * @ORM\Entity()
 * @Fixture(defaultBehavior="append")
 */
class SomeEntity { ....

So for each entity we could set default behavior of append, purge or ignore this entity. This way we'd have more control over purging tables.