orm
orm copied to clipboard
🐛 EM::persistState inserts the same entity twice
No duplicates 🥲.
- [X] I have searched for a similar issue in our bug tracker and didn't find any solutions.
What happened?
Entity manager inserts the same entity twice if the entity has persisted using the persistState method
$import = $orm->make('import');
$em->persistState($import)->run();
$em->persistState($import)->run();
Error
[Cycle\Database\Exception\StatementException\ConstrainException]
SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "import_pkey"
DETAIL: Key (id)=(60) already exists.
Version
ORM 2.2.0
PHP 8.1