I’ve an error that I can’t understand. My usecase is that I want to inform user by mail if some properties are changed in updateAction. To decide if regarding properties are changed I use following code:
/** @var UnitOfWork $uow */
$uow = $this->entityManager->getUnitOfWork();
This works fine on my localhost, but on production server isEntityScheduled() always returns false.
Difference between localhost are FLOW_CONTEXT and php version. I tried to set context to production on my localhost to reproduce this behavior. But even in production mode it returns true. May the php version lead to this error? Locally I use php 7.2.21 and on the server there is 7.2.34 installed. On my MAMP version 7.2.34 is not available - so I can’t test.
This is driving me crazy, as I’ve no idea what to look up. So every hint is welcome.
EDIT: Flow Version is 5.3.15
Welcome to the community
Can you show, how and where you access the entityManager? Is it inside the action?
Perhaps you want to use a EventSubscriber or EventListener
This way you can isolate the functionality form your action
thanks for your welcome and your reply.
I use it indeed inside an action. The way I embed the entitymanager is by injection.
Above the class definiton I did:
I tried it in the model itself with the preUpdate() method, which I use for other purposes. But I thought that it is a overhead as I only want the emails triggered in rare cases and the object is very often update by external API’s. The other drawback was that I had to build an uri passed to the email and use a translator for the email subject. I do not think that such things should be in a model.
I tried a few more things:
also I tried it with other entities, but all show the same behavior. Works on localhost but not on the production server.
If you have any clue where I can debug this strange behavior, let me know.