Le 16/06/2011 18:08, keymaster a écrit :
I've seen different ways of naming services.

Fos_user:

fos_user.registration.form.builder
fos_user.mailer.default

Sonata:

sonata.admin.form.type.admin
sonata.admin.pool
sonata.admin.route_loader

In general they all reasonably seem to start with the namespace, then some kind of section within the namespace, then it's up for grabs. Most are separated by dots.

Are there any rules? Best practices?

What happens if by mistake you name a service the same as some other service in the system?
The best practice is to use a dot as segment separator and to use the alias of the bundle (the same than you use for your DI extensions) as first segment. Then, segment should be lowercased using underscores as word separator as service names are case insensitive anyway.

So FOSUserBundle follows this best practice, SonataAdminBundle should use sonata_admin.* But the way they use is not a big issue as they start with the vendor name so conflicts can only occur between their different bundles, and they can take care of it.

--
Christophe | Stof

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to