Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.45 KB

File metadata and controls

45 lines (32 loc) · 1.45 KB

XmlWriterTask

Writes the \DOMDocument received as input to an XML file, whose path is set in the options. Requires the dom PHP extension.

Task reference

  • Service: CleverAge\ProcessBundle\Task\File\Xml\XmlWriterTask

Accepted inputs

\DOMDocument: document to dump with DOMDocument::saveXML. An \UnexpectedValueException is thrown for any other type.

Possible outputs

string: path of the written file (value of the file_path option).

Options

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)

Examples

# Task configuration level
write_xml:
  service: '@CleverAge\ProcessBundle\Task\File\Xml\XmlWriterTask'
  options:
    file_path: '%kernel.project_dir%/var/data/file.xml'

Notes

  • The file is opened on each execution: with the default wb mode, each input overwrites the file.