Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

File loaders can now set the type to load explicitly#7353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
javiereguiluz wants to merge5 commits intosymfony:masterfromjaviereguiluz:fix_7352
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletionscomponents/config/resources.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
*/
9 changes: 9 additions & 0 deletionscomponents/dependency_injection.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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 </components/yaml>`.

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

Expand Down
42 changes: 42 additions & 0 deletionsconfiguration.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xmlns:twig="http://symfony.com/schema/dic/twig"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd
http://symfony.com/schema/dic/twig
http://symfony.com/schema/dic/twig/twig-1.0.xsd">

<imports>
<import resource="parameters.res" type="yml" />
<!-- ... -->
</imports>
</container>

.. code-block:: php

// app/config/config.php
$this->import('parameters.res', 'yml');
// ...

.. _config-parameter-intro:

The parameters Key: Parameters (Variables)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp