Commands:
Commands which I have to run in the Background are kept in the command directory. They are either called by the cron, or triggered using event listeners to perform a particular operation triggered at a particular event.
Factories:
For storing the fake data in the database for testing purpose, we can use Factory.
Security Voters:
For user authorisation purposes, I have created security voters. It is used to check if the authenticated user has the required permission to access the requested resource or not.
Serializer:
Used to serialize and deserialize the data.
When we have to convert the complex object, ORM object, or any complex array in the form of data which can be easily transmitted like json, at that time we can use seriliser
Normalizer:
Normalizer is a component of the Symfony Serializer system, that is responsible to convert complex objects into json. I used it for the purpose of encapsulating the data by removing unwanted fields and data from the response.
Validator:
For validating the input data, symfony has a standalone component called Validator. It is used to apply the validations in the input data. In the modern web application, the backend architecture is classified in the different code layers which helps in keeping code simple, understandable, easy to manage and reusable. Each layer has their own responsibility like the controller is responsible to handle the request but not to validate. For validation, the framework has a separate feature like RequestClass or Symfony Validator,,,,,which is responsible to validate the input data and through the error in case if the validation failed.
Event Listener:
Event Subscriber:
When you have to handle multiple events in a single class, you can use event subscriber