Skip to content

Commit cac3c6c

Browse files
committed
Merge remote-tracking branch 'origin/master' into di-3.3-changes
* origin/master: (36 commits) Use the short Yaml syntax for service definition [#7613] remove reference to AsseticBundle minor #7613 Twig Extensions Reference minor brush-up (mpdude) Fix service locator declaration Minor reword Update Title in controller.rst Update scheme.rst Update requirements.rst [3.3] Document FQCN named controllers Document FQCN named controllers Use the short tag syntax [#7845] minor tweaks Update translation_domain.rst.inc Update page_creation.rst to correct hidden colon Update forms.rst Rewords Fixed the form types of the buttons in the Form reference [#7832] use bin/console for Symfony 3.x Minor reword Update deployment.rst ...
2 parents 2229fd3 + a9f975b commit cac3c6c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+702
-143
lines changed

best_practices/security.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,7 @@ To enable the security voter in the application, define a new service:
339339
class: AppBundle\Security\PostVoter
340340
arguments: ['@security.access.decision_manager']
341341
public: false
342-
tags:
343-
- { name: security.voter }
342+
tags: [security.voter]
344343
345344
Now, you can use the voter with the ``@Security`` annotation:
346345

best_practices/templates.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ name is irrelevant because you never use it in your own code):
158158
class: AppBundle\Twig\AppExtension
159159
arguments: ['@app.markdown']
160160
public: false
161-
tags:
162-
- { name: twig.extension }
161+
tags: [twig.extension]
163162
164163
.. _`Twig`: http://twig.sensiolabs.org/
165164
.. _`Parsedown`: http://parsedown.org/

components/cache/cache_pools.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
single: PDO Cache, Doctrine DBAL Cache
1010
single: Redis Cache
1111

12+
.. _component-cache-cache-pools:
13+
1214
Cache Pools and Supported Adapters
1315
==================================
1416

components/phpunit_bridge.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ If you have this kind of time-related tests::
208208

209209
You used the :doc:`Symfony Stopwatch Component </components/stopwatch>` to
210210
calculate the duration time of your process, here 10 seconds. However, depending
211-
on the load of the server your the processes running on your local machine, the
211+
on the load of the server or the processes running on your local machine, the
212212
``$duration`` could for example be `10.000023s` instead of `10s`.
213213

214214
This kind of tests are called transient tests: they are failing randomly
@@ -390,7 +390,7 @@ Modified PHPUnit script
390390
-----------------------
391391

392392
.. versionadded:: 3.2
393-
The modified PHPUnit script script was introduced in the 3.2 version of
393+
This modified PHPUnit script was introduced in the 3.2 version of
394394
this component.
395395

396396
This bridge provides a modified version of PHPUnit that you can call by using
@@ -423,8 +423,8 @@ If you have installed the bridge through Composer, you can run it by calling e.g
423423

424424
.. tip::
425425

426-
Set the ``SYMFONY_PHPUNIT_REMOVE`` env var to ``symfony/yaml`` if you need
427-
``prophecy`` but not ``symfony/yaml``.
426+
If you still need to use ``prophecy`` (but not ``symfony/yaml``),
427+
then set the ``SYMFONY_PHPUNIT_REMOVE`` env var to ``symfony/yaml``.
428428

429429
.. _PHPUnit: https://phpunit.de
430430
.. _`PHPUnit event listener`: https://phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestListener

console.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ you can extend your test from
273273
{
274274
public function testExecute()
275275
{
276-
$kernel = $this->createKernel();
276+
$kernel = static::createKernel();
277277
$kernel->boot();
278278

279279
$application = new Application($kernel);

console/commands_as_services.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ with ``console.command``:
2929
services:
3030
app.command.my_command:
3131
class: AppBundle\Command\MyCommand
32-
tags:
33-
- { name: console.command }
32+
tags: [console.command]
3433
3534
.. code-block:: xml
3635
@@ -89,7 +88,7 @@ store the default value in some ``%command.default_name%`` parameter::
8988
public function __construct($defaultName)
9089
{
9190
$this->defaultName = $defaultName;
92-
91+
9392
parent::__construct();
9493
}
9594

@@ -135,8 +134,7 @@ inject the ``command.default_name`` parameter:
135134
app.command.my_command:
136135
class: AppBundle\Command\MyCommand
137136
arguments: ["%command.default_name%"]
138-
tags:
139-
- { name: console.command }
137+
tags: [console.command]
140138
141139
.. code-block:: xml
142140

contributing/code/tests.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ what's going on and if the tests are broken because of the new code.
5555
to see colored test results.
5656

5757
.. _Cmder: http://cmder.net/
58-
.. _ConEmu: https://code.google.com/p/conemu-maximus5/
58+
.. _ConEmu: https://conemu.github.io/
5959
.. _ANSICON: https://github.com/adoxa/ansicon/releases
6060
.. _Mintty: https://mintty.github.io/

controller.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ The Symfony templating system and Twig are explained more in the
236236
single: Controller; Accessing services
237237

238238
.. _controller-accessing-services:
239+
.. _accessing-other-services:
239240

240241
Fetching Services as Arguments
241242
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

controller/service.rst

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,36 +66,36 @@ Then you can define it as a service as follows:
6666
6767
# app/config/services.yml
6868
services:
69-
app.hello_controller:
70-
class: AppBundle\Controller\HelloController
69+
AppBundle\Controller\HelloController: ~
7170
7271
.. code-block:: xml
7372
7473
<!-- app/config/services.xml -->
7574
<services>
76-
<service id="app.hello_controller" class="AppBundle\Controller\HelloController" />
75+
<service id="AppBundle\Controller\HelloController" />
7776
</services>
7877
7978
.. code-block:: php
8079
8180
// app/config/services.php
8281
use AppBundle\Controller\HelloController;
8382
84-
$container->register('app.hello_controller', HelloController::class);
83+
$container->register(HelloController::class);
8584
8685
Referring to the Service
8786
------------------------
8887

89-
To refer to a controller that's defined as a service, use the single colon (:)
90-
notation. For example, to forward to the ``indexAction()`` method of the service
91-
defined above with the id ``app.hello_controller``::
88+
If the service id is the fully-qualified class name (FQCN) of your controller,
89+
you can keep using the usual notation. For example, to forward to the
90+
``indexAction()`` method of the above ``AppBundle\Controller\HelloController``
91+
service::
9292

93-
$this->forward('app.hello_controller:indexAction', array('name' => $name));
93+
$this->forward('AppBundle:Hello:index', array('name' => $name));
9494

95-
.. note::
95+
Otherwise, use the single colon (``:``) notation. For example, to forward to the
96+
``indexAction()`` method of a service with the id ``app.hello_controller``::
9697

97-
You cannot drop the ``Action`` part of the method name when using this
98-
syntax.
98+
$this->forward('app.hello_controller:indexAction', array('name' => $name));
9999

100100
You can also route to the service by using the same notation when defining
101101
the route ``_controller`` value:
@@ -123,17 +123,24 @@ the route ``_controller`` value:
123123
'_controller' => 'app.hello_controller:indexAction',
124124
)));
125125
126+
.. note::
127+
128+
You cannot drop the ``Action`` part of the method name when using the
129+
single colon notation.
130+
126131
.. tip::
127132

128133
You can also use annotations to configure routing using a controller
129134
defined as a service. Make sure you specify the service ID in the
130-
``@Route`` annotation. See the `FrameworkExtraBundle documentation`_ for
131-
details.
135+
``@Route`` annotation if your service ID is not your controller
136+
fully-qualified class name (FQCN). See the
137+
`FrameworkExtraBundle documentation`_ for details.
132138

133139
.. tip::
134140

135141
If your controller implements the ``__invoke()`` method, you can simply
136-
refer to the service id (``app.hello_controller``).
142+
refer to the service id (``AppBundle\Controller\HelloController`` or
143+
``app.hello_controller`` for example).
137144

138145
Alternatives to base Controller Methods
139146
---------------------------------------
@@ -209,15 +216,14 @@ argument:
209216
210217
# app/config/services.yml
211218
services:
212-
app.hello_controller:
213-
class: AppBundle\Controller\HelloController
219+
AppBundle\Controller\HelloController:
214220
arguments: ['@templating']
215221
216222
.. code-block:: xml
217223
218224
<!-- app/config/services.xml -->
219225
<services>
220-
<service id="app.hello_controller" class="AppBundle\Controller\HelloController">
226+
<service id="AppBundle\Controller\HelloController">
221227
<argument type="service" id="templating"/>
222228
</service>
223229
</services>
@@ -226,13 +232,10 @@ argument:
226232
227233
// app/config/services.php
228234
use AppBundle\Controller\HelloController;
229-
use Symfony\Component\DependencyInjection\Definition;
230235
use Symfony\Component\DependencyInjection\Reference;
231236
232-
$container->setDefinition('app.hello_controller', new Definition(
233-
HelloController::class,
234-
array(new Reference('templating'))
235-
));
237+
$container->register(HelloController::class)
238+
->addArgument(new Reference('templating'));
236239
237240
Rather than fetching the ``templating`` service from the container, you can
238241
inject *only* the exact service(s) that you need directly into the controller.

deployment.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ specifically tailored to the requirements of Symfony.
8080
`Capistrano`_ with `Symfony plugin`_
8181
`Capistrano`_ is a remote server automation and deployment tool written in Ruby.
8282
`Symfony plugin`_ is a plugin to ease Symfony related tasks, inspired by `Capifony`_
83-
(which works only with Capistrano 2 )
83+
(which works only with Capistrano 2).
8484

8585
`sf2debpkg`_
8686
Helps you build a native Debian package for your Symfony project.
@@ -182,12 +182,12 @@ setup:
182182
* Pushing assets to a CDN
183183
* ...
184184

185-
Application Lifecycle: Continuous Integration, QA, etc
186-
------------------------------------------------------
185+
Application Lifecycle: Continuous Integration, QA, etc.
186+
-------------------------------------------------------
187187

188188
While this entry covers the technical details of deploying, the full lifecycle
189-
of taking code from development up to production may have a lot more steps
190-
(think deploying to staging, QA (Quality Assurance), running tests, etc).
189+
of taking code from development up to production may have more steps:
190+
deploying to staging, QA (Quality Assurance), running tests, etc.
191191

192192
The use of staging, testing, QA, continuous integration, database migrations
193193
and the capability to roll back in case of failure are all strongly advised. There

0 commit comments

Comments
 (0)