Symfony – Change an entity field with calling a method

  doctrine, php, symfony

I am using Symfony 5 and trying to solve the following issue in a good way:

Issue: We have some sports classes, which have startTime and also status. We want to create a feature to change the status to finished automatically when a class has finished.
We assume that the sport classes are finished after 2 hours from the startTime.

We use doctrine, Symfony 5, and also we have a sportClass entity with id, name, startTime and status fields.

Do you know any good idea, where and how we should trigger updating status to finished?

Source: Ask PHP