From 7793b2b1fbddeca3e0e6a6d3457040c616c10f4b Mon Sep 17 00:00:00 2001 From: WouterJ Date: Fri, 3 May 2013 13:36:46 +0200 Subject: [PATCH] [#2531] Documented dumpFile --- components/filesystem.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/components/filesystem.rst b/components/filesystem.rst index 6e5ca5140fa..a5f54c28753 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -227,6 +227,25 @@ isAbsolutePath returns true if the given path is absolute, false otherwise:: // return false $fs->isAbsolutePath('../dir'); +.. versionadded:: 2.3 + ``dumpFile`` is new in Symfony 2.3 + +dumpFile +~~~~~~~~ + +:method:`Symfony\\Component\\Filesystem\\Filesystem::dumpFile` allows you to +dump contents in a file. It does it in a atomic manner, that means it writes a +temporary file first and then moves that to the new place when it's finished. +This means the user does see either the old or the new state + +.. code-block:: php + + $fs->dumpFile('file.txt', 'Hello World'); + +The ``file.txt`` file contains ``Hello World`` now. + +A desired file mode can be passed as third argument. + Error Handling --------------