Le 18/01/2011 15:16, Carlos Sánchez a écrit :
My goal is very simple, just create a configurable bundle using
semantic configuration as suggested in 'Bundle Configuration' guide
http://docs.symfony-reloaded.org/master/guides/bundles/configuration.html

I am able to understand de creation of the extension in
DependencyInjection folder and its methods, but what really confuses
me is the load of xml files in xxxLoad method.
I am unable to understand de meaning of those files, services,
classes, etc...
let's take this one taken from symfony2news project:

<container xmlns="http://www.symfony-project.org/schema/dic/services";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://www.symfony-project.org/schema/dic/
services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd";>

   <parameters>
     <parameter key="news.planet.class">Application\SymfonyNewsBundle
\Service\Rss</parameter>
     <parameter key="news.planet.client.class">Zend\Http\Client</
parameter>
     <parameter key="news.planet.adapter">Zend\Http\Client\Adapter
\Socket</parameter>
     <parameter key="news.planet.url"></parameter>
   </parameters>

   <services>
     <service id="planet" class="%news.planet.class%">
       <argument type="service" id="planet.client" />
       <argument type="service" id="zend.cache" on-invalid="ignore" />
     </service>
[....]


I've taken a close look to many others projects in github, let's say
symfony2bundle, symfony2news, lilches, ForumBundle,  and read related
syfmon2 docs (http://docs.symfony-reloaded.org/master/guides/
dependency_injection/extensions.html), without success.

¿How do I create my example.xml file, just to hold one parameter
definition/value?
¿What structure should it contain?
¿How do I use the parameter in may app/controller?

Well, I am a bit confused with all this, be very glad if someone will
provide a simple example.

Thanks in advanced.

This file contains the definition of parameters and services you need to import. Then the end-user parameters (available in the $config array) will let you choose which file you load, or overwrite some parameters. You could also define the entire services in the Extension but loading a file makes it more readable for someone you wants to see which services are defined by the extensions.

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

Reply via email to