8000 Merge branch '3.3' into 3.4 · uestla/symfony-docs@e91c5f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit e91c5f9

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: Mentioned the TargetPathTrait utility Added a mention to the createTable() method of the session handler Remove out-of-context rewrite rule tip Mention cachetool utility to clear OPcache cache from CLI Documented the use of PHP streams as the process input
2 parents 049096c + 1c1df71 commit e91c5f9

File tree

5 files changed

+66
-8
lines changed

5 files changed

+66
-8
lines changed

components/process.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,29 @@ stream resources or Traversable objects as argument. As shown in the above examp
230230
you need to explicitly call the :method:`Symfony\\Component\\Process\\InputStream::close`
231231
method when you are done writing to the standard input of the subprocess.
232232

233+
Using PHP Streams as the Standard Input of a Process
234+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
235+
236+
The input of a process can also be defined using `PHP streams`_::
237+
238+
$stream = fopen('php://temporary', 'w+');
239+
240+
$process = new Process('cat');
241+
$process->setInput($stream);
242+
$process->start();
243+
244+
fwrite($stream, 'foo');
245+
246+
// ... read process output or do other things
247+
248+
fwrite($stream, 'bar');
249+
fclose($stream);
250+
251+
$process->wait();
252+
253+
// will echo: 'foobar'
254+
echo $process->getOutput();
255+
233256
Stopping a Process
234257
------------------
235258

@@ -420,3 +443,4 @@ Use :method:`Symfony\\Component\\Process\\Process::disableOutput` and
420443
.. _`pid`: https://en.wikipedia.org/wiki/Process_identifier
421444
.. _`PHP Documentation`: http://php.net/manual/en/pcntl.constants.php
422445
.. _Packagist: https://packagist.org/packages/symfony/process
446+
.. _`PHP streams`: http://www.php.net/manual/en/book.stream.php

components/serializer.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,6 @@ You are now able to serialize only attributes in the groups you want::
326326
);
327327
// $obj2 = MyObj(foo: 'foo', bar: 'bar')
328328

329-
.. include:: /_includes/_rewrite_rule_tip.rst.inc
330-
331329
.. _ignoring-attributes-when-serializing:
332330

333331
Selecting Specific Attributes

doctrine/pdo_session_storage.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ a second array argument to ``PdoSessionHandler``:
151151
))
152152
;
153153
154-
These are parameters that you must configure:
154+
These are parameters that you can configure:
155155

156156
``db_table`` (default ``sessions``):
157157
The name of the session table in your database;
@@ -227,8 +227,18 @@ Preparing the Database to Store Sessions
227227
----------------------------------------
228228

229229
Before storing sessions in the database, you must create the table that stores
230-
the information. The following sections contain some examples of the SQL statements
231-
you may use for your specific database engine.
230+
the information. The session handler provides a method called
231+
:method:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler::createTable`
232+
to set up this table for you according to the database engine used::
233+
234+
try {
235+
$sessionHandlerService->createTable();
236+
} catch (\PDOException $e) {
237+
// the table could not be created for some reason
238+
}
239+
240+
If you prefer to set up the table yourself, these are some examples of the SQL
241+
statements you may use according to your specific database engine.
232242

233243
MySQL
234244
~~~~~

performance.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,13 @@ using APC and ``opcache_reset()`` when using OPcache).
5555

5656
In PHP, the CLI and the web processes don't share the same OPcache. This
5757
means that you cannot clear the web server OPcache by executing some command
58-
in your terminal. You either need to restart the web server or call the
59-
``apc_clear_cache()`` or ``opcache_reset()`` functions via the web server
60-
(i.e. by having these in a script that you execute over the web).
58+
in your terminal. These are some of the possible solutions:
59+
60+
#. Restart the web server;
61+
#. Call the :phpfunction:`apc_clear_cache` or :phpfunction:`opcache_reset`
62+
functions via the web server (i.e. by having these in a script that
63+
you execute over the web);
64+
#. Use the `cachetool`_ utility to control APC and OPcache from the CLI.
6165

6266
Optimizing all the Files Used by Symfony
6367
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -134,3 +138,4 @@ Learn more
134138
.. _`APC`: http://php.net/manual/en/book.apc.php
135139
.. _`APCu Polyfill component`: https://github.com/symfony/polyfill-apcu
136140
.. _`APCu PHP functions`: http://php.net/manual/en/ref.apcu.php
141+
.. _`cachetool`: https://github.com/gordalina/cachetool

security/form_login.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,3 +430,24 @@ are now fully customized:
430430
<input type="hidden" name="back_to" value="<?php echo $view['router']->path('forgot_password') ?>" />
431431
<input type="submit" name="login" />
432432
</form>
433+
434+
Redirecting to the Last Accessed Page with ``TargetPathTrait``
435+
--------------------------------------------------------------
436+
437+
The last request URI is stored in a session variable named
438+
``_security.<your providerKey>.target_path`` (e.g. ``_security.main.target_path``
439+
if the name of your firewall is ``main``). Most of the times you don't have to
440+
deal with this low level session variable. However, if you ever need to get or
441+
remove this variable, it's better to use the
442+
:class:`Symfony\\Component\\Security\\Http\\Util\\TargetPathTrait` utility::
443+
444+
// ...
445+
use Symfony\Component\Security\Http\Util\TargetPathTrait;
446+
447+
$targetPath = $this->getTargetPath($request->getSession(), $providerKey);
448+
449+
// equivalent to:
450+
// $targetPath = $request->getSession()->get('_security.'.$providerKey.'.target_path');
451+
452+
.. versionadded:: 3.1
453+
The ``TargetPathTrait`` was introduced in Symfony 3.1.

0 commit comments

Comments
 (0)
0