class DatasourcesHelper

This class implements common functions needed for data sources management.

Properties

private SimpleXMLElement $datasources

Methods

void
__construct(SimpleXMLElement $datasources)

Constructor of class DatasourcesHelper

makeDatasourceDom(string $schemafile, string $datafile, array $parameters, string $databasesDir, int $id, TranslatorInterface|null $translator = null, callable|null $fprogress = null)

Creates and returns a DOM XML document from json-schema.org compliant JSON data files and schemas

doCreateDatasource(array $form)

Creates and returns a data source into a DOM element from a form.

getDatabase(array $parameters, int $dbid, string $databasesDir, bool $withDbName = true)

Creates and returns a database interface

DOMElement|null
convertDOMNodeToDOMElement(DOMNode $node)

Converts a DOMNode to a DOMElement

Details

at line 58
void __construct(SimpleXMLElement $datasources)

Constructor of class DatasourcesHelper

Parameters

SimpleXMLElement $datasources The data sources of DataSources.xml

Return Value

void

at line 76
DOMDocument makeDatasourceDom(string $schemafile, string $datafile, array $parameters, string $databasesDir, int $id, TranslatorInterface|null $translator = null, callable|null $fprogress = null)

Creates and returns a DOM XML document from json-schema.org compliant JSON data files and schemas

Parameters

string $schemafile The path of the JSON schema file
string $datafile The path of the JSON data file
array $parameters The database parameters
string $databasesDir The databases directory
int $id &$id The ID of the data source
TranslatorInterface|null $translator (default: null) true if the row is to be restored, false otherwise
callable|null $fprogress a function receiving the row number that's inserted

Return Value

DOMDocument The XML DOM document

at line 144
DOMElement doCreateDatasource(array $form)

Creates and returns a data source into a DOM element from a form.

Parameters

array $form The form fields

Return Value

DOMElement The DOM element

at line 219
Database getDatabase(array $parameters, int $dbid, string $databasesDir, bool $withDbName = true)

Creates and returns a database interface

Parameters

array $parameters The database parameters
int $dbid The database id in DataSources.xml
string $databasesDir The databases directory
bool $withDbName (default: true) if false the database name is not inserted into the dsn string

Return Value

Database The Database object of the databae interface.

at line 261
DOMElement|null convertDOMNodeToDOMElement(DOMNode $node)

Converts a DOMNode to a DOMElement

Parameters

DOMNode $node The DOMNode

Return Value

DOMElement|null The DOMElement.