Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data insert instead of update after EntityManager Reset when closed #11766

Open
bilal-renegade opened this issue Dec 12, 2024 · 0 comments
Open

Comments

@bilal-renegade
Copy link

I have a problem with entityManager when flushing multiple entities,
try {
$products = $this->getProducts();
$this->processUpdateProducts($products);
} catch (EntityManagerClosed $e) {
$this->managerRegistry->resetManager();
$this->entityManager = $this->managerRegistry->getManager();
$products = $this->getProducts();
$this->processUpdateProducts($products);
}
I load more than 200 products and have a batch flush max of 50 at once. in some scenarios entityManager is closed, I load again those products that are not executing and then update products,
then it throw ORMInvalidArgumentException (Multiple non-persistance entities) because of in unitOfWork method doPersist and line no 2054
$entityState = $this->getEntityState($entity, self::STATE_NEW);
is always return 2 which is incorrect I want to update not insert,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant