Propel 2 API
Class

Propel\Runtime\Parser\YamlParser

class YamlParser extends AbstractParser

YAML parser.

Converts data between associative array and YAML formats

Methods

string fromArray(array $array)

Converts data from an associative array to YAML.

array toArray(string $data)

Converts data from YAML to an associative array.

listFromArray($data)

from AbstractParser
listToArray($data)

from AbstractParser
string load(string $path)

Loads data from a file.

from AbstractParser
dump(string $data, string $path = null)

Dumps data to a file, or to STDOUT if no filename is given

from AbstractParser
static AbstractParser getParser(string $type = 'XML')

Factory for getting an instance of a subclass of AbstractParser

from AbstractParser
string toYAML(array $array)

Alias for YamlParser::fromArray()

array fromYAML(string $data)

Alias for YamlParser::toArray()

Details

at line 28
public string fromArray(array $array)

Converts data from an associative array to YAML.

Parameters

array $array Source data to convert

Return Value

string Converted data, as a YAML string

at line 50
public array toArray(string $data)

Converts data from YAML to an associative array.

Parameters

string $data Source data to convert, as a YAML string

Return Value

array Converted data

in AbstractParser at line 43
public listFromArray($data)

Parameters

$data

in AbstractParser at line 48
public listToArray($data)

Parameters

$data

in AbstractParser at line 60
public string load(string $path)

Loads data from a file.

Executes PHP code blocks in the file.

Parameters

string $path Path to the file to load

Return Value

string The file content processed by PHP

in AbstractParser at line 79
public dump(string $data, string $path = null)

Dumps data to a file, or to STDOUT if no filename is given

Parameters

string $data The file content
string $path Path of the file to create

in AbstractParser at line 95
static public AbstractParser getParser(string $type = 'XML')

Factory for getting an instance of a subclass of AbstractParser

Parameters

string $type Parser type, amon 'XML', 'YAML', 'JSON', and 'CSV'

Return Value

AbstractParser A PropelParser subclass instance

at line 39
public string toYAML(array $array)

Alias for YamlParser::fromArray()

Parameters

array $array Source data to convert

Return Value

string Converted data, as a YAML string

at line 61
public array fromYAML(string $data)

Alias for YamlParser::toArray()

Parameters

string $data Source data to convert, as a YAML string

Return Value

array Converted data