Organizing services with tags
One useful configuration feature that can be used in the service settings is a tag. It does not alter a service in any way, rather it provides properties that can be used in services for better organization.
For example, open the services.yml
file in AppBundle and look at the configuration that SonataUserBundle creates to address the user profile edit form:
services:
mava_user.profile.form.type:
class: AppBundle\Form\ProfileType
tags:
- { name: form.type, alias: mava_user_profile }
Now open the
config.yml
file and scroll down to sonata_user
:
sonata_user:
security_acl: true
manager_type: orm
profile:
form:
type: mava_user_profile
As you can see, Sonata uses tags to address the Profile Edit form for users. In other words, the alias in the tags parameter defines the name for the form type that is used to edit profile information for users. The same alias value is used in the ProfileType class in the form...