orm icon indicating copy to clipboard operation
orm copied to clipboard

🐛 EM::persistState inserts the same entity twice

Open roxblnfk opened this issue 3 years ago • 0 comments

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

roxblnfk avatar Jul 12 '22 09:07 roxblnfk