$objectRepository = $objectManager->getRepository(MyEntity::class);
$myEntity = $objectRepository->findOneBy(["name" => "AAA"]); // returns an object
$myEntity->changeName("BBB");
$myEntity = $objectRepository->findOneBy(["name" => "BBB"]); // doesn't return anything
I have some high level repository like UserRepository, ProductRepository, etc, with methods like ->add(User $user), or ->findByName($name), etc
And I use these Repositories across all my code to manipulate the entities, but since these entities are not persisted and flushed on EACH change, the Repositories cannot return changed entities because the doctrine's object repository cannot find the entities.
Any idea? Thanks