Symfony – How to call a controller from within a Listener?

I have an Repas (meal) entity in which every baby’s meal is recorded.

I have a Jour (day) entity that stores totals and other relevant information.

Every time a Repas is added or updated, I want to update the Jour entity.
In can do that in the RepasController.php. But, in order to be DRY I want to prevent code duplication in add() and update() methods. Therefore, I’ve create a RepasListener.

The problem I have is that I don’t know how to call a method inside JourController from wihin my listener.

Could anyone give me some help.

Thanks.

Antonio

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *