cycle/orm

๐Ÿ› EM::persistState inserts the same entity twice

roxblnfk opened this issue ยท 0 comments

No duplicates ๐Ÿฅฒ.

  • 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