The context
I am refactoring an application in ZF2 that uses scripts to synchronize data with web services and APIs.
Currently each script resides in a controller, that is called through cron jobs running index.php script_route
.
These controllers are defined in the module config as invokables, have routes attributed to them and a console
key in the config, they are essentially procedural.
All business logic currently resides in the controllers, all which extend the same class, a sort of central controller, no factories or interfaces. All entities are anemic and used basically for doctrine only.
The problem
In the process of introducing brand new "auxiliary" routines, small synchronization tasks, i stumbled upon the question of where should i put them? Is the correct approach to make them invokable services, called by a controller? Or should they be a controller themselves? They will most likely be used in a single point in the application (during sync operations), that's why I'm unsure if a service is appropriate. What would be a more "Zend Framework" and "OOP" way of structuring these "tasks"?