Entities are imported twice, when there is a bi-directional cascade configuration:
// [...]
class List {
// [...]
/**
* @OneToMany(targetEntity="Item", mappedBy="list", cascade={"all"})
* @var Collection of Item objects
*/
private $items;
}
// [...]
class Item {
// [...]
/**
* @ManyToOne(targetEntity="List", inversedBy="items", fetch="EAGER", cascade={"persist"})
* @JoinColumn(referencedColumnName="id")
* @var List
*/
private $list;
}
// [...]
$infrastructure->import($item)
This is caused by \Webfactory\Doctrine\ORMTestInfrastructure\Importer::importFromCallback() in combination with \Webfactory\Doctrine\ORMTestInfrastructure\DetachingObjectManagerDecorator, which executes flush() twice:
Entities are imported twice, when there is a bi-directional cascade configuration:
This is caused by
\Webfactory\Doctrine\ORMTestInfrastructure\Importer::importFromCallback()
in combination with\Webfactory\Doctrine\ORMTestInfrastructure\DetachingObjectManagerDecorator
, which executesflush()
twice: