Propel 2 API
Class

Propel\Runtime\Parser\AbstractParser

abstract class AbstractParser

Base class for all parsers.

A parser converts data from and to an associative array.

Methods

mixed fromArray(array $array)

Converts data from an associative array to the parser format.

array toArray(mixed $data)

Converts data from the parser format to an associative array.

listFromArray($data)

listToArray($data)

string load(string $path)

Loads data from a file.

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

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

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

Factory for getting an instance of a subclass of AbstractParser

Details

at line 31
abstract public mixed fromArray(array $array)

Converts data from an associative array to the parser format.

Override in the parser driver.

Parameters

array $array Source data to convert

Return Value

mixed Converted data, depending on the parser format

at line 41
abstract public array toArray(mixed $data)

Converts data from the parser format to an associative array.

Override in the parser driver.

Parameters

mixed $data Source data to convert, depending on the parser format

Return Value

array Converted data

at line 43
public listFromArray($data)

Parameters

$data

at line 48
public listToArray($data)

Parameters

$data

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

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

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