You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I inject my entity manager into the worker via dependency injection and I receive following error when running the worker:
Detached entity Dtc\QueueBundle\Entity\Run@0000000078ced8230000000079c36310 cannot be removed
Is that because the bundle is using a different em? Actually I configured it to use the default orm.
EDIT:
I figured out passing the class is not a problem, but inside the worker I need to use its own EntityManager like the following: public function getProducts(Customer $customer) { $customer = $this->entityManager->find('App:Customer', $customer->getId()); ...
Would that be the right way or should I pass the EM aswell?
The text was updated successfully, but these errors were encountered:
@maikelreyes Well, I think I've learned that passing objects as argument isn't the best way to go. Especially if you switch from using ORM driven queue to RabbitMQ for example (which I would recommend due to performance and stability), you can't pass objects anymore and you should use IDs. So when I switched to IDs, I haven't had any issues like that anymore.
In my case I passed an entity object to the worker. Indeed the worker uses a different entity manager, because it's a different PHP process, it makes sense.
Not sure if "passing objects as argument isn't the best way to go", but indeed this can be very tricky, depending on what is passed on.
Hey, I inject my entity manager into the worker via dependency injection and I receive following error when running the worker:
Is that because the bundle is using a different em? Actually I configured it to use the default orm.
EDIT:
I figured out passing the class is not a problem, but inside the worker I need to use its own EntityManager like the following:
public function getProducts(Customer $customer) { $customer = $this->entityManager->find('App:Customer', $customer->getId()); ...
Would that be the right way or should I pass the EM aswell?
The text was updated successfully, but these errors were encountered: