.

IDataObject Interface Reference
[Interfaces]

Base interface for data objects. More...

Inheritance diagram for IDataObject:
ISearchAdapter IDBTable IDBWhereHolder DataObjectBase DAOCache DAOCoursesTest DAOFormvalidations DAORoomsTest DAOSessions DAOStudentsTest DAOStudentsTest2CoursesTest DAOSystemupdates DAOTeachersTest DataObjectCached

List of all members.

Public Member Functions

  delete ($policy=self::NORMAL)
  Delete this object.
  equals ($other)
  Returns true if a both this and the given object are identical.
  fetch ()
  fetches next row into this objects var's
  fetch_array ()
  Fetch and return an array.
  find ($policy=self::NORMAL)
  Find results, either normal or crosstable.
  find_array ()
  Return array of elements, based on current configuration.
  get ($column_or_value, $value=null)
  Returns first result of a select for $value on $column_or_value.
  insert ()
  Insert data.
  is_same_as ($other)
  Returns true if a both this and the given object refer to the same instance in the DB.
  quote ($val)
  Quote and escape a string.
  read_from_array ($values)
  read properties of object form array
  replace ()
  Inserts if data does not exist, updates else.
  save ()
  Either update or insert object.
  set_default_values ()
  Sets all default values on instance.
  update ($policy=self::NORMAL)
  Update current item.
  validate ()
  Validate this object.

Public Attributes

const  AUTOFETCH = 1
const  NORMAL = 0
const  WHERE_ONLY = 1

Detailed Description

Base interface for data objects.

Author:
Gerd Riesselmann

Definition at line 12 of file idataobject.cls.php.


Member Function Documentation

IDataObject::delete ( policy = self::NORMAL  ) 

Delete this object.

Parameters:
int  $policy If IDataObject::WHERE_ONLY is used, no conditions are build automatically
Returns:
Status

Implemented in DataObjectBase.

IDataObject::equals ( other  ) 

Returns true if a both this and the given object are identical.

The codes tests if table and all fields are identical. Note that this function may return false in cases when is_same_as() returns true.

Parameters:
IDataObject  $other
Returns:
bool

Implemented in DataObjectBase.

IDataObject::fetch (  ) 

fetches next row into this objects var's

returns true on success false on failure

Example $object = new mytable(); $object->name = "fred"; $object->find(); $store = array(); while ($object->fetch()) { echo $this->ID; $store[] = $object; // builds an array of object lines. }

Returns:
boolean True on success

Implemented in DataObjectBase, and DataObjectCached.

IDataObject::fetch_array (  ) 

Fetch and return an array.

Returns:
array Array of IDataObject

Implemented in DataObjectBase.

IDataObject::find ( policy = self::NORMAL  ) 

Find results, either normal or crosstable.

for example

$object = new mytable(); $object->ID = 1; $object->find();

Parameters:
int  $policy If set to IDataObject::AUTOFETCH, first record is fetched automatically
Returns:
int Number of rows found

Implemented in DataObjectBase.

IDataObject::find_array (  ) 

Return array of elements, based on current configuration.

Returns:
array Array of IDataObject

Implemented in DataObjectBase.

IDataObject::get ( column_or_value,
value = null  
)

Returns first result of a select for $value on $column_or_value.

If $value is empty, this function assumes $column_or_value contains the value of first key column

Parameters:
mixed  $column_or_value
mixed  $value

Implemented in DataObjectBase.

IDataObject::insert (  ) 

Insert data.

Autoincrement IDs will be automatically set.

Returns:
Status

Implemented in DataObjectBase, and DataObjectTimestampedCached.

IDataObject::is_same_as ( other  ) 

Returns true if a both this and the given object refer to the same instance in the DB.

The codes tests if table and key fields are identical. Note that this function returns true even if some properties are not identical. Use equals() to test this

Parameters:
IDataObject  $other
Returns:
bool

Implemented in DataObjectBase.

IDataObject::quote ( val  ) 

Quote and escape a string.

Parameters:
string  $val
Returns:
string

Implemented in DataObjectBase.

IDataObject::read_from_array ( values  ) 

read properties of object form array

Parameters:
array  $values Associative array with property name as key and property value as value

Implemented in DataObjectBase.

IDataObject::replace (  ) 

Inserts if data does not exist, updates else.

This function queries the database, that is it does not use MySQL "replace into" It does not handle autoupdated ids. That is: It only works if all keys are set

Returns:
Status

Implemented in DataObjectBase.

IDataObject::save (  ) 

Either update or insert object.

This function handles autoupdating IDs

Returns:
Status

Implemented in DataObjectBase.

IDataObject::set_default_values (  ) 

Sets all default values on instance.

Previous values are overwritten!

Implemented in DataObjectBase.

IDataObject::update ( policy = self::NORMAL  ) 

Update current item.

Parameters:
int  $policy IDataObject::WHERE_ONLY is used, no conditions are build automatically
Returns:
Status

Implemented in DataObjectBase, and DataObjectTimestampedCached.

IDataObject::validate (  ) 

Validate this object.

Returns:
Status Error

Implemented in DataObjectBase.


Member Data Documentation

Definition at line 15 of file idataobject.cls.php.

Definition at line 13 of file idataobject.cls.php.

Definition at line 14 of file idataobject.cls.php.


The documentation for this interface was generated from the following file: