diff --git a/components/config/resources.rst b/components/config/resources.rst index 97924703158..de88b483b42 100644 --- a/components/config/resources.rst +++ b/components/config/resources.rst @@ -87,8 +87,6 @@ the resource:: $loaderResolver = new LoaderResolver(array(new YamlUserLoader($locator))); $delegatingLoader = new DelegatingLoader($loaderResolver); + // YamlUserLoader is used to load this resource because it supports + // files with the '.yml' extension $delegatingLoader->load(__DIR__.'/users.yml'); - /* - The YamlUserLoader will be used to load this resource, - since it supports files with a "yml" extension - */ diff --git a/components/dependency_injection.rst b/components/dependency_injection.rst index 7b50076940a..cc20d5f8dce 100644 --- a/components/dependency_injection.rst +++ b/components/dependency_injection.rst @@ -216,6 +216,15 @@ Loading a YAML config file:: If you want to load YAML config files then you will also need to install :doc:`the Yaml component `. +.. tip:: + + If your application uses unconventional file extensions (for example, your + XML files have a ``.config`` extension) you can pass the file type as the + second optional parameter of the ``load()`` method:: + + // ... + $loader->load('services.config', 'xml'); + If you *do* want to use PHP to create the services then you can move this into a separate config file and load it in a similar way:: diff --git a/configuration.rst b/configuration.rst index a72c8a9313b..11e97923b8d 100644 --- a/configuration.rst +++ b/configuration.rst @@ -181,6 +181,48 @@ The ``imports`` key works a lot like the PHP ``include()`` function: the content ``parameters.yml``, ``security.yml`` and ``services.yml`` are read and loaded. You can also load XML files or PHP files. +.. tip:: + + If your application uses unconventional file extensions (for example, your + YAML files have a ``.res`` extension) you can set the file type explicitly + with the ``type`` option: + + .. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + imports: + - { resource: parameters.res, type: yml } + # ... + + .. code-block:: xml + + + + + + + + + + + + .. code-block:: php + + // app/config/config.php + $this->import('parameters.res', 'yml'); + // ... + .. _config-parameter-intro: The parameters Key: Parameters (Variables)