Structures_DataGrid_DataSource_DataObject
[ class tree: Structures_DataGrid_DataSource_DataObject ] [ index: Structures_DataGrid_DataSource_DataObject ] [ all elements ]

Class: Structures_DataGrid_DataSource_DataObject

Source Location: /Structures_DataGrid_DataSource_DataObject-0.2.2dev1/Structures/DataGrid/DataSource/DataObject.php

Class Overview

Structures_DataGrid_DataSource
   |
   --Structures_DataGrid_DataSource_DataObject

PEAR::DB_DataObject Data Source Driver


Author(s):

Version:

  • $Revision: 256890 $

Methods


Inherited Variables

Inherited Methods


Class Details

[line 136]
PEAR::DB_DataObject Data Source Driver

This class is a data source driver for a PEAR::DB::DB_DataObject object

SUPPORTED OPTIONS:

  • 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.
  • 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.
  • 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.
  • 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 ignored.
  • link_level: (int) The maximum link display level. If equal to 0 the links will not be followed.
  • 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.
  • 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.
  • 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'.
  • 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().
  • 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.
GENERAL NOTES:

You can use getters in your DataObject, this driver will look for them and call them if found, instead of accessing the corresponding property. Two slightly different types of getters are supported.

Example: if you have a property named my_field, this driver will first search for getMyField() (camel case), and then for getMy_field() (DB_DataObject compliant). If it can't find any it will access the my_field property directly.



[ Top ]


Method Detail

Structures_DataGrid_DataSource_DataObject (Constructor)   [line 172]

Structures_DataGrid_DataSource_DataObject Structures_DataGrid_DataSource_DataObject( object DB_DataObject 0)

Constructor
  • Access: public

Parameters:

object DB_DataObject   0   — 

[ Top ]

bind   [line 202]

mixed bind( &$dataobject, [array $options = array()], object DB_DataObject $dataobject)

Bind
  • Return: True on success, PEAR_Error on failure
  • Access: public

Parameters:

object DB_DataObject   $dataobject   —  The DB_DataObject object to bind
array   $options   —  Associative array of options.
   &$dataobject   — 

[ Top ]

count   [line 439]

int count( )

Count
  • Return: The number of records or a PEAR_Error
  • Access: public

[ Top ]

fetch   [line 278]

array &fetch( [integer $offset = 0], [integer $len = null])

Fetch
  • Return: The 2D Array of the records
  • Access: public

Parameters:

integer   $offset   —  Limit offset (starting from 0)
integer   $len   —  Limit length

[ Top ]

sort   [line 495]

void sort( mixed $sortSpec, [string $sortDir = null])

Sorts the dataobject. This MUST be called before fetch.
  • Access: public

Parameters:

mixed   $sortSpec   —  A single field (string) to sort by, or a sort specification array of the form: array(field => direction, ...)
string   $sortDir   —  Sort direction: 'ASC' or 'DESC' This is ignored if $sortDesc is an array

[ Top ]

_convertLinkKey   [line 474]

string _convertLinkKey( string $field)

Converts a link key field name to its original name if needed
  • Return: Field name with "__key" suffix removed, if needed
  • Access: protected

Parameters:

string   $field   —  Field name

[ Top ]

_getDataObjectString   [line 400]

string _getDataObjectString( &$do, [int $linkLevel = 1], [int $level = 1], DB_DataObject $do)

Represent a DataObject as a string, following links

This method is a modified version of DB_DataObject_FormBuilder::getDataObjectString()


Parameters:

DB_DataObject   $do   —  The dataobject to get the display value for
int   $linkLevel   —  Maximum link level to follow
int   $level   —  The current recursion level. For internal use only.
   &$do   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:40:01 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.