DatasourcesTrait
trait DatasourcesTrait
This class implements common functions needed in G6KBundle controllers.
Properties
protected array | $datatypes |
Methods
Constructs a Database object
Returns informations about the columns of a table
Constructs a form fields with informations about the columns of a table
Retrieves the choice values of a data in the result list of a query on a data source
Executes the query from a source
Filters the result set of a query on the source return path
Filters the result set of a query on the source return path
Inserts a row into a table
Updates a table row
Deletes a row from a table
Checks the value of a column
Does the migration of data from a database to another.
Creates a database
Creates a database table
Drops a table
Edits a table structure
Emulates a 'ALTER TABLE' for columns of a SQLite database.
Details
at line 192
protected Database
getDatabase(int $dsid, SimpleXMLElement $datasources, string|null $databasesDir = null, bool $withDbName = true)
Constructs a Database object
at line 211
protected array|string|bool|null
tablesList(Database $database)
Returns the list of tables of a database
at line 249
protected array|string|bool|null
tableInfos(Database $database, string $table)
Returns informations about a table of a database
at line 302
protected array
infosColumns(SimpleXMLElement $datasources, Database $database, string $table)
Returns informations about the columns of a table
at line 361
protected array
infosColumnsToForm(string $table, array $infosColumns)
Constructs a form fields with informations about the columns of a table
at line 398
protected array
getChoicesFromSource(SimpleXMLElement $source, array|null $result)
Retrieves the choice values of a data in the result list of a query on a data source
at line 461
protected array|string|null
executeSource(SimpleXMLElement $source, SimpleXMLElement $datasources, string|null $databasesDir = null)
Executes the query from a source
at line 523
protected array|null
filterResult(array|string $result, SimpleXMLElement $source)
Filters the result set of a query on the source return path
at line 548
protected array
filterResultByLines(array $result, string $filter)
Filters the result set of a query on the source return path
at line 589
protected string|bool
insertRowIntoTable(array $row, string $table, array $infosColumns, Database $database, TranslatorInterface $translator = null, bool $restore = false, bool $fromOtherTable = false)
Inserts a row into a table
at line 638
protected bool|string
updateRowInTable(array $row, string $table, SimpleXMLElement $datasources, Database $database, TranslatorInterface $translator = null, bool $fromOtherTable = false)
Updates a table row
at line 685
protected string|true
deleteRowFromTable(array $row, string $table, Database $database, TranslatorInterface $translator = null)
Deletes a row from a table
at line 709
protected string|bool
checkColumnValue(array $info, string|null $value, TranslatorInterface $translator = null, bool $fromOtherTable = false)
Checks the value of a column
at line 847
protected string|true
migrateDatabase(int $dsid, string $dbtype, SimpleXMLElement $datasources, SimpleXMLElement $fromDatasources, Database $fromDatabase, string|null $databasesDir = null, TranslatorInterface $translator = null, callable|null $fprogress = null)
Does the migration of data from a database to another.
at line 895
protected string|true
createDatabase(int $dsid, string $dbtype, SimpleXMLElement $datasources, string|null $databasesDir = null, TranslatorInterface $translator = null)
Creates a database
at line 953
protected string|true
createDatabaseTable(array $form, Database $database, TranslatorInterface $translator = null)
Creates a database table
at line 1032
protected string|true
dropDatabaseTable(string $table, Database $database, TranslatorInterface $translator = null)
Drops a table
at line 1057
protected string|true
editTableStructure(array $form, string $table, Database $database, SimpleXMLElement $datasources, TranslatorInterface $translator = null)
Edits a table structure
at line 1277
protected bool
alterSQLiteTable(string $table, string $alterdefs, Database $database, TranslatorInterface $translator = null)
Emulates a 'ALTER TABLE' for columns of a SQLite database.
ALTER TABLE tbl_name alter_specification [, alter_specification] ...
alter_specification: ADD column_definition | DROP column_definition | CHANGE old_col_name column_definition
column_definition: same as for create table statements