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

Start using ConfigBuilder#15264

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

Merged
javiereguiluz merged 1 commit intosymfony:5.xfromNyholm:config.builder
Apr 21, 2021
Merged
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
20 changes: 10 additions & 10 deletionsforms.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -345,13 +345,13 @@ can set this option to generate forms compatible with the Bootstrap 4 CSS framew
.. code-block:: php

// config/packages/twig.php
$container->loadFromExtension('twig', [
'form_themes' => [
'bootstrap_4_layout.html.twig',
],
use Symfony\Config\TwigConfig;

return static function (TwigConfig $twig) {
$twig->formThemes(['bootstrap_4_layout.html.twig']);

// ...
]);
};

The :ref:`built-in Symfony form themes <symfony-builtin-forms>` include
Bootstrap 3 and 4 as well as Foundation 5 and 6. You can also
Expand DownExpand Up@@ -627,11 +627,11 @@ these new messages set the ``legacy_error_messages`` option to ``false``:
.. code-block:: php

// config/packages/framework.php
$container->loadFromExtension('framework', [
'form' => [
'legacy_error_messages' => false,
],
]);
use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework) {
$framework->form()->legacyErrorMessages(false);
};

Other Common Form Features
--------------------------
Expand Down
11 changes: 5 additions & 6 deletionsrouting.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2508,12 +2508,11 @@ The solution is to configure the ``default_uri`` option to define the
.. code-block:: php

// config/packages/routing.php
$container->loadFromExtension('framework', [
'router' => [
// ...
'default_uri' => "https://example.org/my/path/",
],
]);
use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework) {
$framework->router()->defaultUri('https://example.org/my/path/');
};

.. versionadded:: 5.1

Expand Down
11 changes: 5 additions & 6 deletionsserializer.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -259,12 +259,11 @@ value:
.. code-block:: php

// config/packages/framework.php
$container->loadFromExtension('framework', [
// ...
'serializer' => [
'name_converter' => 'serializer.name_converter.camel_case_to_snake_case',
],
]);
use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework) {
$framework->serializer()->nameConverter('serializer.name_converter.camel_case_to_snake_case');
};

Going Further with the Serializer
---------------------------------
Expand Down
32 changes: 18 additions & 14 deletionssession.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -55,18 +55,20 @@ sessions, check their default configuration:
.. code-block:: php

// config/packages/framework.php
$container->loadFromExtension('framework', [
'session' => [
use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework) {
$framework->session()
// enables the support of sessions in the app
'enabled' =>true,
->enabled(true)
// ID of the service used for session storage
// NULL means that Symfony uses PHP default session mechanism
'handler_id' =>null,
->handlerId(null)
// improves the security of the cookies used for sessions
'cookie_secure' =>'auto',
'cookie_samesite' =>'lax',
],
]);
->cookieSecure('auto')
->cookieSamesite('lax')
;
};

Setting the ``handler_id`` config option to ``null`` means that Symfony will
use the native PHP session mechanism. The session metadata files will be stored
Expand DownExpand Up@@ -112,13 +114,15 @@ session metadata files:
.. code-block:: php

// config/packages/framework.php
$container->loadFromExtension('framework', [
'session' => [
use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework) {
$framework->session()
// ...
'handler_id' =>'session.handler.native_file',
'save_path' =>'%kernel.project_dir%/var/sessions/%kernel.environment%',
],
]);
->handlerId('session.handler.native_file')
->savePath('%kernel.project_dir%/var/sessions/%kernel.environment%')
;
};

Check out the Symfony config reference to learn more about the other available
:ref:`Session configuration options <config-framework-session>`. You can also
Expand Down
38 changes: 21 additions & 17 deletionstemplates.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -824,10 +824,12 @@ template fragments. Configure that special URL in the ``fragments`` option:
.. code-block:: php

// config/packages/framework.php
$container->loadFromExtension('framework', [
use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework) {
// ...
'fragments' => ['path' => '/_fragment'],
]);
$framework->fragments()->path('/_fragment');
};

.. caution::

Expand DownExpand Up@@ -1043,15 +1045,16 @@ the ``value`` is the Twig namespace, which is explained later:
.. code-block:: php

// config/packages/twig.php
$container->loadFromExtension('twig', [
use Symfony\Config\TwigConfig;

return static function (TwigConfig $twig) {
// ...
'paths' => [
// directories are relative to the project root dir (but you
// can also use absolute directories)
'email/default/templates' => null,
'backend/templates' => null,
],
]);

// directories are relative to the project root dir (but you
// can also use absolute directories)
$twig->path('email/default/templates', null);
$twig->path('backend/templates', null);
};

When rendering a template, Symfony looks for it first in the ``twig.paths``
directories that don't define a namespace and then falls back to the default
Expand DownExpand Up@@ -1098,13 +1101,14 @@ configuration to define a namespace for each template directory:
.. code-block:: php

// config/packages/twig.php
$container->loadFromExtension('twig', [
use Symfony\Config\TwigConfig;

return static function (TwigConfig $twig) {
// ...
'paths' => [
'email/default/templates' => 'email',
'backend/templates' => 'admin',
],
]);

$twig->path('email/default/templates', 'email');
$twig->path('backend/templates', 'admin');
};

Now, if you render the ``layout.html.twig`` template, Symfony will render the
``templates/layout.html.twig`` file. Use the special syntax ``@`` + namespace to
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp