Skip to content

Error on entity association after a reset #36

Description

@Ngob

This issue is for the class ResetableEntityManager

// LEt assume we already have a $e1Dao (a random Dao) and a $em (entityManager)
function Foo($linkedEntity, $e1Dao, $em) {

  $e1 = new E1();
  $e1->addLinked($linkedEntity);

  $em->persist($e1Dao);
  $em->flush();
}

function Baz() {
  try {
 /** An operation which close the connection and force the creation of a new EntityManager (like a duplicate entry)**/
  }
  catch(Exception $e) {
  }
}

$linkedEntity = $e1Dao->findUniqueBy(["id" => 1]);
Baz();
Foo($linkedEntity, $e1Dao, $em);

We got the following error " new entity was found through the relationship...", that mean the $linkedEntity is no longer recognized by the entityManager used at the "Flush moment" because the entityManager was recreated.
Hope this help.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions