This class is a data source driver for a PEAR::DB::DB_DataObject object
This driver supports the following operation modes:
Mode | Supported? |
---|---|
Multiple field sorting | yes |
Insert, update and delete records | no |
This driver accepts the following options:
Option | Type | Description | Default Value |
---|---|---|---|
fields | array | Which data fields to fetch from the datasource. An empty array means: all fields. Form: array(field1, field2, ...) | array() |
fields_order_property | string | The name of a property that you can set within your DataObject. It will be used to set the order in which fields are displayed, as long as you're not configuring this by adding/generating columns. Also requires the fields_property to be set. | null |
fields_property | string | The name of a property that you can set within your DataObject. This property is expected to contain the same kind of information as the 'fields' option. If the 'fields' option is set, this one will not be used. | 'fb_fieldsToRender' |
formbuilder_integration | bool | DEPRECATED: use link_level and fields_order_property instead. For BC, Setting this to true is equivalent to setting link_level to 3 and fields_order_property to 'fb_preDefOrder'. | false |
generate_columns | bool | Generate Structures_DataGrid_Column objects with labels. See the 'labels' option. DEPRECATED: use Structures_DataGrid::generateColumns() instead | false |
labels | array | Data field to column label mapping. Only used when 'generate_columns' is true. Form: array(field => label, ...) DEPRECATED: use Structures_DataGrid::generateColumns() instead | array() |
labels_property | string | The name of a property that you can set within your DataObject. This property should contain the same kind of information as the 'labels' option. If the 'labels' option is set, this one will not be used. | 'fb_fieldLabels' |
link_keep_key | bool | Set this to true when you want to keep the original values (usually foreign keys) of fields which are being replaced by their linked values. The record will then contain additional keys with "__key" prepended. This option only makes sense with link_level higher than 0. Example: if the country_code original value is 'FR' and this is replaced by "France" from the linked country table, then setting link_keep_key to true will keep the "FR" value in country_code__key. | false |
link_level | int | The maximum link display level. If equal to 0 the links will not be followed. | 0 |
link_property | string | The name of a property you can set within a linked DataObject. This property should contain a array of field names that will be used to display a string out of this linked DataObject. Has no effect when link_level is 0. | 'fb_linkDisplayFields' |
primaryKey | array | Name(s), or numerical index(es) of the field(s) which contain a unique record identifier (only use several fields in case of a multiple-fields primary key) | null |
raw_count | bool | If true: query all the records in order to count them. This is needed when records are grouped (GROUP BY, DISTINCT, etc..), but might be heavy. If false: perform a smart count query with DB_DataObject::count(). | false |
return_objects | bool | If true, the returned records will consists of clones of the dataobject instead of associative arrays. This is especially useful when used in conjunction with the smarty renderer for example, to directly access the dataobject properties and methods from your templates. | false |
sort_property | string | The name of a property that you can set within your DataObject. This property should contain an array of the form: array("field1", "field1 DESC", ...) If the data is already being sorted then this this property's content will be appended to the current ordering. | 'fb_linkOrderFields' |
Bind a DB_DataObject to Structures_DataGrid
<?php
$person = new DataObjects_Person;
$person->hair = 'red';
$person->has_glasses = 1;
$datagrid->bind($person);
?>