Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit bee43ea

Browse files
vicbfabpot
authored andcommitted
[gentle intro] ch 17 - plugin configuration
1 parent 2627866 commit bee43ea

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

gentle-introduction/en/17-Extending-Symfony.markdown

+10-4
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,8 @@ Listing 17-18 - File Structure of a Plug-In
520520

521521
pluginName/
522522
config/
523-
routing.yml // Application config file
523+
routing.yml // Routing config file
524+
app.yml // Plugin default settings
524525
*schema.yml // Data schema
525526
*schema.xml
526527
config.php // Specific plug-in configuration
@@ -598,16 +599,21 @@ Listing 17-19 - Example of Propel Schema Declaration in a Plug-In, in `myPlugin/
598599
> }
599600
>
600601
602+
>**TIP**: Defining the default settings in `config/app.yml`
603+
>The plugin own default settings can be defined in its `config/app.yml` file.
604+
>However overriding settings defined in an other plugin is not safe as the final value would depends on the `app.yml` files loading order.
605+
>Custom application configuration can be used in the plug-in code (for instance, by using `sfConfig::get('app_myplugin_foo')`) and the settings can be overridden at the application level (see Listing 17-20 for an example)
606+
>Handling of the default values can be done by using the second argument of the `sfConfig::get()` method or by defining it in the plugin `app.yml` file.
607+
601608
#### Manual Plug-In Setup
602609

603610
There are some elements that the `plugin:install` task cannot handle on its own, and which require manual setup during installation:
604611

605-
* Custom application configuration can be used in the plug-in code (for instance, by using `sfConfig::get('app_myplugin_foo')`), but you can't put the default values in an `app.yml` file located in the plug-in `config/` directory. To handle default values, use the second argument of the `sfConfig::get()` method. The settings can still be overridden at the application level (see Listing 17-25 for an example).
606-
* Custom routing rules have to be added manually to the application `routing.yml`.
612+
* Custom routing should be added either by the plugin code on the `routing.load_configuration` event or manually to the application `routing.yml`.
607613
* Custom filters have to be added manually to the application `filters.yml`.
608614
* Custom factories have to be added manually to the application `factories.yml`.
609615

610-
Generally speaking, all the configuration that should end up in one of the application configuration files has to be added manually. Plug-ins with such manual setup should embed a `README` file describing installation in detail.
616+
Plug-ins with such manual setup should embed a `README` file describing installation in detail.
611617

612618
#### Customizing a Plug-In for an Application
613619

0 commit comments

Comments
 (0)