You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
Copy file name to clipboardExpand all lines: gentle-introduction/en/17-Extending-Symfony.markdown
+10-4
Original file line number
Diff line number
Diff line change
@@ -520,7 +520,8 @@ Listing 17-18 - File Structure of a Plug-In
520
520
521
521
pluginName/
522
522
config/
523
-
routing.yml // Application config file
523
+
routing.yml // Routing config file
524
+
app.yml // Plugin default settings
524
525
*schema.yml // Data schema
525
526
*schema.xml
526
527
config.php // Specific plug-in configuration
@@ -598,16 +599,21 @@ Listing 17-19 - Example of Propel Schema Declaration in a Plug-In, in `myPlugin/
598
599
> }
599
600
>
600
601
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
+
601
608
#### Manual Plug-In Setup
602
609
603
610
There are some elements that the `plugin:install` task cannot handle on its own, and which require manual setup during installation:
604
611
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`.
607
613
* Custom filters have to be added manually to the application `filters.yml`.
608
614
* Custom factories have to be added manually to the application `factories.yml`.
609
615
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.
0 commit comments