Structures_DataGrid::dataSourceFactory() – Datasource driver Factory


require_once 'Structures/DataGrid.php';

Structures_DataGrid_DataSource|PEAR_Error& Structures_DataGrid::dataSourceFactory ( mixed $source , array $options = array() , string $type = null )


A clever method which loads and instantiate data source drivers.

Can be called in various ways:

Detect the source type and load the appropriate driver with default options:

=& Structures_DataGrid::dataSourceFactory($source);

Detect the source type and load the appropriate driver with custom options:

=& Structures_DataGrid::dataSourceFactory($source$options);

Load a driver for an explicit type (faster, bypasses detection routine):

=& Structures_DataGrid::dataSourceFactory($source$options$type);


mixed $source

The data source respective to the driver

array $options

An associative array of the form: array(optionName => optionValue, ...)

string $type

The data source type constant (of the form DATAGRID_SOURCE_*)

Return value

returns driver object or PEAR_Error on failure


throws no exceptions thrown


see Structures_DataGrid::_detectSourceType()


This function can not be called statically.

Build the datagrid (Previous) Method used for debugging purposes only. Displays a dump of the DataGrid object. (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.