Skip to content

Commit 8a5f600

Browse files
committed
Merge branch '4.2'
* 4.2: Update installation.rst remove Symfony 2/3 versionadded directives remove Symfony 2.8 versionadded directive drop not needed configuration block Removed a small article about console logging Describe things more precisely
2 parents b7be4a5 + f4b9666 commit 8a5f600

File tree

15 files changed

+75
-111
lines changed

15 files changed

+75
-111
lines changed

_build/redirection_map

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
/cookbook/console/commands_as_services /console/commands_as_services
120120
/cookbook/console/console_command /console
121121
/cookbook/console/index /console
122-
/cookbook/console/logging /console/logging
122+
/cookbook/console/logging /console
123123
/cookbook/console/request_context /console/request_context
124124
/cookbook/console/style /console/style
125125
/cookbook/console/usage /console
@@ -402,3 +402,4 @@
402402
/components/weblink /components/web_link
403403
/frontend/encore/installation-no-flex /frontend/encore/installation
404404
/http_cache/form_csrf_caching /security/csrf
405+
/console/logging /console

components/console/events.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ Listeners receive a
114114
$event->setError(new \LogicException('Caught exception', $exitCode, $event->getError()));
115115
});
116116

117+
.. _console-events-terminate:
118+
117119
The ``ConsoleEvents::TERMINATE`` Event
118120
--------------------------------------
119121

components/serializer.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,6 @@ needs three parameters:
166166
#. The name of the class this information will be decoded to
167167
#. The encoder used to convert that information into an array
168168

169-
.. versionadded:: 3.3
170-
171-
Support for the ``allow_extra_attributes`` key in the context was introduced
172-
in Symfony 3.3.
173-
174169
By default, additional attributes that are not mapped to the denormalized object
175170
will be ignored by the Serializer component. If you prefer to throw an exception
176171
when this happens, set the ``allow_extra_attributes`` context option to

components/validator.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ If you have lots of validation errors, you can filter them by error code::
6464
// handle this specific error (display some message, send an email, etc.)
6565
}
6666

67-
.. versionadded:: 3.3
68-
69-
The ``findByCodes()`` method was introduced in Symfony 3.3.
70-
7167
Retrieving a Validator Instance
7268
-------------------------------
7369

configuration/external_parameters.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ the following:
137137
Environment Variable Processors
138138
-------------------------------
139139

140-
.. versionadded:: 3.4
141-
142-
Environment variable processors were introduced in Symfony 3.4.
143-
144140
The values of environment variables are considered strings by default.
145141
However, your code may expect other data types, like integers or booleans.
146142
Symfony solves this problem with *processors*, which modify the contents of the

console.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,15 @@ console::
366366
:class:`Symfony\\Component\\Console\\Application <Symfony\\Component\\Console\\Application>`
367367
and extend the normal ``\PHPUnit\Framework\TestCase``.
368368

369+
Logging Command Errors
370+
----------------------
371+
372+
Whenever an exception is thrown while running commands, Symfony adds a log
373+
message for it including the entire failing command. In addition, Symfony
374+
registers an :doc:`event subscriber </event_dispatcher>` to listen to the
375+
:ref:`ConsoleEvents::TERMINATE event <console-events-terminate>` and adds a log
376+
message whenever a command doesn't finish with the ``0`` exit status.
377+
369378
Learn More
370379
----------
371380

console/request_context.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ will override the defaults.
6565
$container->setParameter('asset.request_context.base_path', $container->getParameter('router.request_context.base_url'));
6666
$container->setParameter('asset.request_context.secure', true);
6767
68-
.. versionadded:: 3.4
69-
70-
The ``asset.request_context.*`` parameters were introduced in Symfony 3.4.
71-
7268
Configuring the Request Context per Command
7369
-------------------------------------------
7470

frontend/encore/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ is the main config file for both Webpack and Webpack Encore:
5757
5858
Encore
5959
// directory where compiled assets will be stored
60-
.setOutputPath('web/build/')
60+
.setOutputPath('public/build/')
6161
// public path used by the web server to access the output path
6262
.setPublicPath('/build')
6363
// only needed for CDN's or sub-directory deploy

messenger/handler_results.rst

Lines changed: 56 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,19 @@ Getting Results from your Handler
66

77
When a message is handled, the :class:`Symfony\\Component\\Messenger\\Middleware\\HandleMessageMiddleware`
88
adds a :class:`Symfony\\Component\\Messenger\\Stamp\\HandledStamp` for each object that handled the message.
9-
You can use this to get the value returned by the handler(s):
9+
You can use this to get the value returned by the handler(s)::
1010

11-
.. configuration-block::
11+
use Symfony\Component\Messenger\MessageBusInterface;
12+
use Symfony\Component\Messenger\Stamp\HandledStamp;
1213

13-
.. code-block:: php
14+
$envelope = $messageBus->dispatch(SomeMessage());
1415

15-
use Symfony\Component\Messenger\MessageBusInterface;
16-
use Symfony\Component\Messenger\Stamp\HandledStamp;
16+
// get the value that was returned by the last message handler
17+
$handledStamp = $envelope->last(HandledStamp::class);
18+
$handledStamp->getResult();
1719

18-
$envelope = $messageBus->dispatch(SomeMessage());
19-
20-
// get the value that was returned by the last message handler
21-
$handledStamp = $envelope->last(HandledStamp::class);
22-
$handledStamp->getResult();
23-
24-
// or get info about all of handlers
25-
$handledStamps = $envelope->all(HandledStamp::class);
20+
// or get info about all of handlers
21+
$handledStamps = $envelope->all(HandledStamp::class);
2622

2723
A :class:`Symfony\\Component\\Messenger\\HandleTrait` also exists in order to ease
2824
leveraging a Messenger bus for synchronous needs.
@@ -41,77 +37,69 @@ As queries are usually synchronous and expected to be handled once,
4137
getting the result from the handler is a common need.
4238

4339
To make this easy, you can leverage the ``HandleTrait`` in any class that has
44-
a ``$messageBus`` property:
40+
a ``$messageBus`` property::
41+
42+
// src/Action/ListItems.php
43+
namespace App\Action;
4544

46-
.. configuration-block::
45+
use App\Message\ListItemsQuery;
46+
use App\MessageHandler\ListItemsQueryResult;
47+
use Symfony\Component\Messenger\HandleTrait;
48+
use Symfony\Component\Messenger\MessageBusInterface;
4749

48-
.. code-block:: php
50+
class ListItems
51+
{
52+
use HandleTrait;
53+
54+
public function __construct(MessageBusInterface $messageBus)
55+
{
56+
$this->messageBus = $messageBus;
57+
}
4958

50-
// src/Action/ListItems.php
51-
namespace App\Action;
59+
public function __invoke()
60+
{
61+
$result = $this->query(new ListItemsQuery(/* ... */));
5262

53-
use App\Message\ListItemsQuery;
54-
use App\MessageHandler\ListItemsQueryResult;
55-
use Symfony\Component\Messenger\HandleTrait;
56-
use Symfony\Component\Messenger\MessageBusInterface;
63+
// Do something with the result
64+
// ...
65+
}
5766

58-
class ListItems
67+
// Creating such a method is optional, but allows type-hinting the result
68+
private function query(ListItemsQuery $query): ListItemsResult
5969
{
60-
use HandleTrait;
61-
62-
public function __construct(MessageBusInterface $messageBus)
63-
{
64-
$this->messageBus = $messageBus;
65-
}
66-
67-
public function __invoke()
68-
{
69-
$result = $this->query(new ListItemsQuery(/* ... */));
70-
71-
// Do something with the result
72-
// ...
73-
}
74-
75-
// Creating such a method is optional, but allows type-hinting the result
76-
private function query(ListItemsQuery $query): ListItemsResult
77-
{
78-
return $this->handle($query);
79-
}
70+
return $this->handle($query);
8071
}
72+
}
8173

8274
Hence, you can use the trait to create command & query bus classes.
8375
For example, you could create a special ``QueryBus`` class and inject it
84-
wherever you need a query bus behavior instead of the ``MessageBusInterface``:
76+
wherever you need a query bus behavior instead of the ``MessageBusInterface``::
8577

86-
.. configuration-block::
78+
// src/MessageBus/QueryBus.php
79+
namespace App\MessageBus;
8780

88-
.. code-block:: php
81+
use Symfony\Component\Messenger\Envelope;
82+
use Symfony\Component\Messenger\HandleTrait;
83+
use Symfony\Component\Messenger\MessageBusInterface;
8984

90-
// src/MessageBus/QueryBus.php
91-
namespace App\MessageBus;
85+
class QueryBus
86+
{
87+
use HandleTrait;
9288

93-
use Symfony\Component\Messenger\Envelope;
94-
use Symfony\Component\Messenger\HandleTrait;
95-
use Symfony\Component\Messenger\MessageBusInterface;
89+
public function __construct(MessageBusInterface $messageBus)
90+
{
91+
$this->messageBus = $messageBus;
92+
}
9693

97-
class QueryBus
94+
/**
95+
* @param object|Envelope $query
96+
*
97+
* @return mixed The handler returned value
98+
*/
99+
public function query($query)
98100
{
99-
use HandleTrait;
100-
101-
public function __construct(MessageBusInterface $messageBus)
102-
{
103-
$this->messageBus = $messageBus;
104-
}
105-
106-
/**
107-
* @param object|Envelope $query
108-
*
109-
* @return mixed The handler returned value
110-
*/
111-
public function query($query)
112-
{
113-
return $this->handle($query);
114-
}
101+
return $this->handle($query);
115102
}
103+
}
116104

117105
.. _`article about CQRS`: https://martinfowler.com/bliki/CQRS.html

reference/configuration/framework.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,10 +1638,6 @@ for translation files.
16381638
default_path
16391639
............
16401640

1641-
.. versionadded:: 3.4
1642-
1643-
The ``default_path`` option was introduced in Symfony 3.4.
1644-
16451641
**type**: ``string`` **default**: ``%kernel.project_dir%/translations``
16461642

16471643
This option allows to define the path where the application translations files

0 commit comments

Comments
 (0)