Skip to Content
Mastering Symfony
book

Mastering Symfony

by Sohail Salehi
April 2016
Intermediate to advanced content levelIntermediate to advanced
290 pages
5h 51m
English
Packt Publishing
Content preview from Mastering Symfony

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, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Persistence in PHP with Doctrine ORM

Persistence in PHP with Doctrine ORM

Kevin Dunglas
PHP Web Services

PHP Web Services

Lorna Jane Mitchell
Mastering PHP 7

Mastering PHP 7

Branko Ajzele
PHP 7: Real World Application Development

PHP 7: Real World Application Development

Doug Bierer, Altaf Hussain, Branko Ajzele

Publisher Resources

ISBN: 9781784390310Supplemental Content