Writes the \DOMDocument received as input to an XML file, whose path is set in the options.
Requires the dom PHP extension.
- Service:
CleverAge\ProcessBundle\Task\File\Xml\XmlWriterTask
\DOMDocument: document to dump with DOMDocument::saveXML.
An \UnexpectedValueException is thrown for any other type.
string: path of the written file (value of the file_path option).
| Code | Type | Required | Default | Description |
|---|---|---|---|---|
file_path |
string |
X | Path of the file to write to | |
mode |
string |
wb |
File open mode (see fopen mode parameter) |
# Task configuration level
write_xml:
service: '@CleverAge\ProcessBundle\Task\File\Xml\XmlWriterTask'
options:
file_path: '%kernel.project_dir%/var/data/file.xml'- The file is opened on each execution: with the default
wbmode, each input overwrites the file.