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

Commit04a65f6

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: Ensure config blocks are consistent
2 parentsd6885fc +fe13157 commit04a65f6

File tree

11 files changed

+153
-91
lines changed

11 files changed

+153
-91
lines changed

‎bundles/best_practices.rst‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,8 @@ The end user can provide values in any configuration file:
427427
<containerxmlns="http://symfony.com/schema/dic/services"
428428
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
429429
xsi:schemaLocation="http://symfony.com/schema/dic/services
430-
https://symfony.com/schema/dic/services/services-1.0.xsd">
431-
430+
https://symfony.com/schema/dic/services/services-1.0.xsd"
431+
>
432432
<parameters>
433433
<parameterkey="acme_blog.author.email">fabien@example.com</parameter>
434434
</parameters>
@@ -438,7 +438,13 @@ The end user can provide values in any configuration file:
438438
..code-block::php
439439
440440
// config/services.php
441-
$container->setParameter('acme_blog.author.email', 'fabien@example.com');
441+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
442+
443+
return static function (ContainerConfigurator $container) {
444+
$container->parameters()
445+
->set('acme_blog.author.email', 'fabien@example.com')
446+
;
447+
};
442448
443449
Retrieve the configuration parameters in your code from the container::
444450

‎bundles/configuration.rst‎

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,30 @@ as integration of other related components:
2020

2121
..code-block::yaml
2222
23+
# config/packages/framework.yaml
2324
framework:
2425
form:true
2526
2627
..code-block::xml
2728
29+
<!-- config/packages/framework.xml-->
2830
<?xml version="1.0" encoding="UTF-8" ?>
2931
<containerxmlns="http://symfony.com/schema/dic/services"
32+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3033
xmlns:framework="http://symfony.com/schema/dic/symfony"
3134
xsi:schemaLocation="http://symfony.com/schema/dic/services
3235
https://symfony.com/schema/dic/services/services-1.0.xsd
3336
http://symfony.com/schema/dic/symfony
34-
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
35-
37+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
38+
>
3639
<framework:config>
3740
<framework:form/>
3841
</framework:config>
3942
</container>
4043
4144
..code-block::php
4245
46+
// config/packages/framework.php
4347
use Symfony\Config\FrameworkConfig;
4448
4549
return static function (FrameworkConfig $framework) {
@@ -71,13 +75,13 @@ can add some configuration that looks like this:
7175
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7276
xmlns:acme-social="http://example.org/schema/dic/acme_social"
7377
xsi:schemaLocation="http://symfony.com/schema/dic/services
74-
https://symfony.com/schema/dic/services/services-1.0.xsd">
75-
78+
https://symfony.com/schema/dic/services/services-1.0.xsd"
79+
>
7680
<acme-social:config>
77-
<acme-social:twitterclient-id="123"client-secret="your_secret"/>
81+
<acme-social:twitterclient-id="123"
82+
client-secret="your_secret"
83+
/>
7884
</acme-social:config>
79-
80-
<!-- ...-->
8185
</container>
8286
8387
..code-block::php
@@ -241,8 +245,8 @@ For example, imagine your bundle has the following example config:
241245
<containerxmlns="http://symfony.com/schema/dic/services"
242246
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
243247
xsi:schemaLocation="http://symfony.com/schema/dic/services
244-
https://symfony.com/schema/dic/services/services-1.0.xsd">
245-
248+
https://symfony.com/schema/dic/services/services-1.0.xsd"
249+
>
246250
<services>
247251
<serviceid="acme.social.twitter_client"class="Acme\SocialBundle\TwitterClient">
248252
<argument></argument><!-- will be filled in with client_id dynamically-->
@@ -504,8 +508,8 @@ Assuming the XSD file is called ``hello-1.0.xsd``, the schema location will be
504508
xsi:schemaLocation="http://symfony.com/schema/dic/services
505509
https://symfony.com/schema/dic/services/services-1.0.xsd
506510
http://acme_company.com/schema/dic/hello
507-
https://acme_company.com/schema/dic/hello/hello-1.0.xsd">
508-
511+
https://acme_company.com/schema/dic/hello/hello-1.0.xsd"
512+
>
509513
<acme-hello:config>
510514
<!-- ...-->
511515
</acme-hello:config>

‎bundles/override.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ to a new validation group:
139139
<constraint-mappingxmlns="http://symfony.com/schema/dic/constraint-mapping"
140140
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
141141
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping
142-
https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
143-
142+
https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"
143+
>
144144
<classname="FOS\UserBundle\Model\User">
145145
<propertyname="plainPassword">
146146
<constraintname="NotBlank">

‎bundles/prepend_extension.rst‎

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,29 +127,35 @@ registered and the ``entity_manager_name`` setting for ``acme_hello`` is set to
127127
http://example.org/schema/dic/acme_something
128128
https://example.org/schema/dic/acme_something/acme_something-1.0.xsd
129129
http://example.org/schema/dic/acme_other
130-
https://example.org/schema/dic/acme_something/acme_other-1.0.xsd">
131-
130+
https://example.org/schema/dic/acme_something/acme_other-1.0.xsd"
131+
>
132132
<acme-something:configuse-acme-goodbye="false">
133133
<!-- ...-->
134134
<acme-something:entity-manager-name>non_default</acme-something:entity-manager-name>
135135
</acme-something:config>
136136
137-
<acme-other:configuse-acme-goodbye="false"/>
137+
<acme-other:configuse-acme-goodbye="false">
138+
<!-- ...-->
139+
</acme-other:config>
138140
139141
</container>
140142
141143
..code-block::php
142144
143145
// config/packages/acme_something.php
144-
$container->loadFromExtension('acme_something', [
145-
// ...
146-
'use_acme_goodbye' => false,
147-
'entity_manager_name' => 'non_default',
148-
]);
149-
$container->loadFromExtension('acme_other', [
150-
// ...
151-
'use_acme_goodbye' => false,
152-
]);
146+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
147+
148+
return static function (ContainerConfigurator $container) {
149+
$container->extension('acme_something', [
150+
// ...
151+
'use_acme_goodbye' => false,
152+
'entity_manager_name' => 'non_default',
153+
]);
154+
$container->extension('acme_other', [
155+
// ...
156+
'use_acme_goodbye' => false,
157+
]);
158+
};
153159
154160
Prepending Extension in the Bundle Class
155161
----------------------------------------

‎cache.rst‎

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@ adapter (template) they use by using the ``app`` and ``system`` key like:
7373
xsi:schemaLocation="http://symfony.com/schema/dic/services
7474
https://symfony.com/schema/dic/services/services-1.0.xsd
7575
http://symfony.com/schema/dic/symfony
76-
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
77-
76+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
77+
>
7878
<framework:config>
79-
<framework:cacheapp="cache.adapter.filesystem"
79+
<framework:cache
80+
app="cache.adapter.filesystem"
8081
system="cache.adapter.system"
8182
/>
8283
</framework:config>
@@ -94,7 +95,6 @@ adapter (template) they use by using the ``app`` and ``system`` key like:
9495
;
9596
};
9697
97-
9898
The Cache component comes with a series of adapters pre-configured:
9999

100100
*:doc:`cache.adapter.apcu</components/cache/adapters/apcu_adapter>`
@@ -137,8 +137,8 @@ will create pools with service IDs that follow the pattern ``cache.[type]``.
137137
xsi:schemaLocation="http://symfony.com/schema/dic/services
138138
https://symfony.com/schema/dic/services/services-1.0.xsd
139139
http://symfony.com/schema/dic/symfony
140-
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
141-
140+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
141+
>
142142
<framework:config>
143143
<!--
144144
default_psr6_provider: Service: cache.psr6
@@ -229,8 +229,8 @@ You can also create more customized pools:
229229
xsi:schemaLocation="http://symfony.com/schema/dic/services
230230
https://symfony.com/schema/dic/services/services-1.0.xsd
231231
http://symfony.com/schema/dic/symfony
232-
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
233-
232+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
233+
>
234234
<framework:config>
235235
<framework:cachedefault-memcached-provider="memcached://localhost">
236236
<!-- creates a "custom_thing.cache" service
@@ -331,6 +331,8 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or
331331
332332
# config/services.yaml
333333
services:
334+
# ...
335+
334336
app.cache.adapter.redis:
335337
parent:'cache.adapter.redis'
336338
tags:
@@ -343,9 +345,11 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or
343345
<containerxmlns="http://symfony.com/schema/dic/services"
344346
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
345347
xsi:schemaLocation="http://symfony.com/schema/dic/services
346-
https://symfony.com/schema/dic/services/services-1.0.xsd">
347-
348+
https://symfony.com/schema/dic/services/services-1.0.xsd"
349+
>
348350
<services>
351+
<!-- ...-->
352+
349353
<serviceid="app.cache.adapter.redis"parent="cache.adapter.redis">
350354
<tagname="cache.pool"namespace="my_custom_namespace"/>
351355
</service>
@@ -357,12 +361,14 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or
357361
// config/services.php
358362
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
359363
360-
return function(ContainerConfigurator $configurator) {
361-
$services = $configurator->services();
364+
return function(ContainerConfigurator $container) {
365+
$container->services()
366+
// ...
362367
363-
$services->set('app.cache.adapter.redis')
364-
->parent('cache.adapter.redis')
365-
->tag('cache.pool', ['namespace' => 'my_custom_namespace']);
368+
->set('app.cache.adapter.redis')
369+
->parent('cache.adapter.redis')
370+
->tag('cache.pool', ['namespace' => 'my_custom_namespace'])
371+
;
366372
};
367373
368374
Custom Provider Options
@@ -404,11 +410,14 @@ and use that when configuring the pool.
404410
xsi:schemaLocation="http://symfony.com/schema/dic/services
405411
https://symfony.com/schema/dic/services/services-1.0.xsd
406412
http://symfony.com/schema/dic/symfony
407-
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
408-
413+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
414+
>
409415
<framework:config>
410416
<framework:cache>
411-
<framework:poolname="cache.my_redis"adapter="cache.adapter.redis"provider="app.my_custom_redis_provider"/>
417+
<framework:poolname="cache.my_redis"
418+
adapter="cache.adapter.redis"
419+
provider="app.my_custom_redis_provider"
420+
/>
412421
</framework:cache>
413422
</framework:config>
414423
@@ -427,6 +436,8 @@ and use that when configuring the pool.
427436
..code-block::php
428437
429438
// config/packages/cache.php
439+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
440+
430441
use Symfony\Component\Cache\Adapter\RedisAdapter;
431442
use Symfony\Component\DependencyInjection\ContainerBuilder;
432443
use Symfony\Config\FrameworkConfig;
@@ -490,11 +501,14 @@ Symfony stores the item automatically in all the missing pools.
490501
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
491502
xmlns:framework="http://symfony.com/schema/dic/symfony"
492503
xsi:schemaLocation="http://symfony.com/schema/dic/services
493-
https://symfony.com/schema/dic/services/services-1.0.xsd">
494-
504+
https://symfony.com/schema/dic/services/services-1.0.xsd
505+
http://symfony.com/schema/dic/symfony
506+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
507+
>
495508
<framework:config>
496509
<framework:cache>
497-
<framework:poolname="my_cache_pool"default-lifetime="31536000">
510+
<framework:poolname="my_cache_pool"
511+
default-lifetime="31536000"><!-- One year-->
498512
<framework:adaptername="cache.adapter.array"/>
499513
<framework:adaptername="cache.adapter.apcu"/>
500514
<framework:adaptername="cache.adapter.redis"provider="redis://user:password@example.com"/>
@@ -585,11 +599,14 @@ to enable this feature. This could be added by using the following configuration
585599
xsi:schemaLocation="http://symfony.com/schema/dic/services
586600
https://symfony.com/schema/dic/services/services-1.0.xsd
587601
http://symfony.com/schema/dic/symfony
588-
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
589-
602+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
603+
>
590604
<framework:config>
591605
<framework:cache>
592-
<framework:poolname="my_cache_pool"adapter="cache.adapter.redis"tags="true"/>
606+
<framework:poolname="my_cache_pool"
607+
adapter="cache.adapter.redis"
608+
tags="true"
609+
/>
593610
</framework:cache>
594611
</framework:config>
595612
</container>
@@ -633,12 +650,17 @@ achieved by specifying the adapter.
633650
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
634651
xmlns:framework="http://symfony.com/schema/dic/symfony"
635652
xsi:schemaLocation="http://symfony.com/schema/dic/services
636-
https://symfony.com/schema/dic/services/services-1.0.xsd">
637-
653+
https://symfony.com/schema/dic/services/services-1.0.xsd
654+
http://symfony.com/schema/dic/symfony
655+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
656+
>
638657
<framework:config>
639658
<framework:cache>
640-
<framework:poolname="my_cache_pool"adapter="cache.adapter.redis"tags="tag_pool"/>
641-
<framework:poolname="tag_pool"adapter="cache.adapter.apcu"/>
659+
<framework:poolname="my_cache_pool"
660+
adapter="cache.adapter.redis"
661+
tags="tag_pool"
662+
/>
663+
<framework:poolname="tag_pool"adapter="cache.adapter.apcu"/>
642664
</framework:cache>
643665
</framework:config>
644666
</container>

‎components/dependency_injection.rst‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,16 @@ config files:
259259
newsletter_manager:
260260
class:NewsletterManager
261261
calls:
262-
-setMailer:['@mailer']
262+
-[setMailer, ['@mailer']]
263263
264264
..code-block::xml
265265
266266
<?xml version="1.0" encoding="UTF-8" ?>
267267
<containerxmlns="http://symfony.com/schema/dic/services"
268268
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
269-
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
270-
269+
xsi:schemaLocation="http://symfony.com/schema/dic/services
270+
https://symfony.com/schema/dic/services/services-1.0.xsd"
271+
>
271272
<parameters>
272273
<!-- ...-->
273274
<parameterkey="mailer.transport">sendmail</parameter>
@@ -290,13 +291,15 @@ config files:
290291
291292
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
292293
293-
return function(ContainerConfigurator $configurator) {
294-
$configurator->parameters()
294+
returnstaticfunction(ContainerConfigurator $container) {
295+
$container->parameters()
295296
// ...
296297
->set('mailer.transport', 'sendmail')
297298
;
298299
299-
$services = $configurator->services();
300+
$container->services()
301+
->set('mailer', 'Mailer')
302+
->args(['%mailer.transport%'])
300303
301304
$services->set('mailer', 'Mailer')
302305
->args([param('mailer.transport')])

‎components/dependency_injection/_imports-parameters-note.rst.inc‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<container xmlns="http://symfony.com/schema/dic/services"
2020
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2121
xsi:schemaLocation="http://symfony.com/schema/dic/services
22-
https://symfony.com/schema/dic/services/services-1.0.xsd">
23-
22+
https://symfony.com/schema/dic/services/services-1.0.xsd"
23+
>
2424
<imports>
2525
<import resource="%kernel.project_dir%/somefile.yaml"/>
2626
</imports>
@@ -29,4 +29,8 @@
2929
.. code-block:: php
3030

3131
// config/services.php
32-
$loader->import('%kernel.project_dir%/somefile.yaml');
32+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
33+
34+
return static function (ContainerConfigurator $container) {
35+
$container->import('%kernel.project_dir%/somefile.yaml');
36+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp