Skip to content

Commit

Permalink
Merge branch '2.7' into 2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Mar 13, 2017
2 parents c1b7b04 + 814d8c4 commit 05c632e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/http_foundation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ represents an HTTP message. But when moving from a legacy system, adding
methods or changing some default behavior might help. In that case, register a
PHP callable that is able to create an instance of your ``Request`` class::

use AppBundle\Http\SpecialRequest;
use Symfony\Component\HttpFoundation\Request;

Request::setFactory(function (
Expand Down
20 changes: 20 additions & 0 deletions components/process.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,26 @@ are done doing other stuff::
which means that your code will halt at this line until the external
process is completed.

.. note::

If a ``Response`` is sent **before** a child process had a chance to complete,
the server process will be killed (depending on your OS). It means that
your task will be stopped right away. Running an asynchronous process
is not the same as running a process that survives its parent process.

If you want your process to survive the request/response cycle, you can
take advantage of the ``kernel.terminate`` event, and run your command
**synchronously** inside this event. Be aware that ``kernel.terminate``
is called only if you use PHP-FPM.

.. caution::

Beware also that if you do that, the said PHP-FPM process will not be
available to serve any new request until the subprocess is finished. This
means you can quickly block your FPM pool if you're not careful enough.
That is why it's generally way better not to do any fancy things even
after the request is sent, but to use a job queue instead.

:method:`Symfony\\Component\\Process\\Process::wait` takes one optional argument:
a callback that is called repeatedly whilst the process is still running, passing
in the output and its type::
Expand Down
5 changes: 5 additions & 0 deletions reference/dic_tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ wrapping their names with ``%`` characters).
sense most of the times to prevent accessing those services directly instead
of using the generic service alias.

.. note::

You need to manually add the ``Symfony\Component\DependencyInjection\Compiler\AutoAliasServicePass``
compiler pass to the container for this feature to work.

console.command
---------------

Expand Down

0 comments on commit 05c632e

Please sign in to comment.