Skip to content

Commit e9291f0

Browse files
committed
Reword
1 parent 72b2e03 commit e9291f0

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

components/dependency_injection/compilation.rst

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,13 @@ serves at dumping the compiled container::
468468
file_put_contents($file, $dumper->dump());
469469
}
470470

471-
472471
.. tip::
473472

474-
Call to `file_put_contents` is not atomic. When generating container in
475-
a production environment with multiple concurrent requests, use `dumpFile`
476-
from `component-filesystem` instead. This generates file in tmp and moves it
477-
to its destination only once it's fully written to.
473+
The ``file_put_contents()`` function is not atomic. That could cause issues
474+
in a production environment with multiple concurrent requests. Instead, use
475+
the :ref:`dumpFile() method <filesystem-dumpfile>` from Symfony Filesystem
476+
component or other methods provided by Symfony (e.g. ``$containerConfigCache->write()``)
477+
which are atomic.
478478

479479
``ProjectServiceContainer`` is the default name given to the dumped container
480480
class. However, you can change this with the ``class`` option when you
@@ -567,11 +567,6 @@ for these resources and use them as metadata for the cache::
567567

568568
require_once $file;
569569
$container = new MyCachedContainer();
570-
571-
.. note::
572-
573-
Using `$containerConfigCache->write` also makes sure that
574-
the file write operation is atomic.
575570

576571
Now the cached dumped container is used regardless of whether debug mode
577572
is on or not. The difference is that the ``ConfigCache`` is set to debug

components/filesystem.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ exception on failure::
291291

292292
The option to set a suffix in ``tempnam()`` was introduced in Symfony 5.1.
293293

294+
.. _filesystem-dumpfile:
295+
294296
``dumpFile``
295297
~~~~~~~~~~~~
296298

0 commit comments

Comments
 (0)