Appearance
Action
Actions are classes that take care of one specific task. Controllers (HTML/JSON/XML/etc.), Console Commands, Nova Actions are just a thin layer that calls Action classes.
Conventions:
finalandreadonly- do not extend any base class
- have only one public method:
execute(...)(except optional magic ones) executemethod is transactional-safe- constructor-level Dependency Injection can be used
- should not be aware about the context (request, session, HTTP/console/job)
You can read everything about actions in the Blogpost by Freek Van der Herten.