On 10/30/2010 03:47 AM, Lukas Kahwe Smith wrote:
On 30.10.2010, at 08:29, Richard D Shank wrote:
On 10/28/2010 07:14 AM, Lukas Kahwe Smith wrote:
On 22.10.2010, at 11:23, Jordi Boggiano wrote:
Heya,
Following the discussion on a DoctrineUserBundle commit [1] I'd like to
propose some sort of best practice.
First have a look at the patch [2] (contains an example config) or the
complete Extension class [3].
Now what I would like to propose is that those two remapParameters*
methods I added would be added to the Symfony core Extension class, so
you could just pass it an array and parse/remap most of your config to
parameters.
This means less code to write and hopefully more standardized and
uniform config schemes.
Cheers
[1] http://github.com/knplabs/DoctrineUserBundle/commit/682c52
[2] http://github.com/Seldaek/DoctrineUserBundle/commit/074df2
[3]
http://github.com/Seldaek/DoctrineUserBundle/blob/config_change/DependencyInjection/DoctrineUserExtension.php
IMHO the remap*() methods should be merged into
Symfony\Component\DependencyInjection\Extension\Extension
+1
There is still one open question.
Should null values override the parameter defaults or be ignored (aka leaving
the default unchanged)?
http://github.com/knplabs/DoctrineUserBundle/commit/6e17ad246e319e8233f36c039b86aeec6deb80cc
IMHO, it makes more sense to have them ignored. I think it makes it
less confusing for someone using the bundle the first time, just copy
and paste the default conifg from the README to the config file.
To me it provides a form of documentation. If at some point in the
future, I decide I want to do a different form for the change_password
(from the example), I don't have to do did back into the README or wiki.
I can open the config and its pretty obvious what needs to be changed.
Right now I cannot think of a use case where one would want to override a
default with null.
The use case for having null values be ignored is being able to list all
options in a config file without having to actually set them to something:
http://gist.github.com/653472
I would agree. However if there were a case, the default value set from
the DI xml file could be set to null. Then, only when it is necessary,
a null in the config would reflect a null in the parameter.
Then again for efficiency reasons it would be better in that case to comment
them anyway.
regards,
Lukas Kahwe Smith
[email protected]
--
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 developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en