ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilADTActiveRecordWrapper Class Reference

ADT Active Record service wrapper class. More...

+ Inheritance diagram for ilADTActiveRecordWrapper:
+ Collaboration diagram for ilADTActiveRecordWrapper:

Public Member Functions

 __construct (ilADTGroupActiveRecordBridge $a_properties)
 Constructor.
 getConnectorContainerName ()
 getPrimaryFieldValue ()
 sleep ($field_name)
 wakeUp ($field_name, $field_value)
- Public Member Functions inherited from ActiveRecord
 getArConnector ()
 getArFieldList ()
 setConnectorContainerName ($connector_container_name)
 setPrimaryFieldValue ($value)
 __construct ($primary_key=0, arConnector $connector=NULL)
 storeObjectToCache ()
 __getConvertedDateFieldsAsArray ($format=NULL)
 __asCsv ($separator= ';', $header=false)
 __asArray ()
 __asStdClass ()
 __asSerializedObject ()
 buildFromArray (array $array)
 getArrayForDb ()
 getArrayForConnector ()
 installConnector ()
 store ()
 save ()
 create ()
 copy ($new_id=0)
 afterObjectLoad ()
 read ()
 update ()
 delete ()
 __call ($name, $arguments)

Static Public Member Functions

static returnDbTableName ()
- Static Public Member Functions inherited from ActiveRecord
static installDB ()
static renameDBField ($old_name, $new_name)
static tableExists ()
static fieldExists ($field_name)
static removeDBField ($field_name)
static updateDB ()
static resetDB ()
static truncateDB ()
static flushDB ()
static preloadObjects ()
static additionalParams (array $additional_params)
static findOrFail ($primary_key, array $add_constructor_args=array())
 Tries to find the object and throws an Exception if object is not found, instead of returning null.
static findOrGetInstance ($primary_key, array $add_constructor_args=array())
static where ($where, $operator=NULL)
static innerjoinAR (ActiveRecord $ar, $on_this, $on_external, $fields=array( '*'), $operator= '=', $both_external=false)
static innerjoin ($tablename, $on_this, $on_external, $fields=array( '*'), $operator= '=', $both_external=false)
static leftjoin ($tablename, $on_this, $on_external, $fields=array( '*'), $operator= '=', $both_external=false)
static orderBy ($orderBy, $orderDirection= 'ASC')
static dateFormat ($date_format= 'd.m.Y-H:i:s')
static limit ($start, $end)
static affectedRows ()
static count ()
static get ()
static debug ()
static first ()
static getCollection ()
static last ()
static getFirstFromLastQuery ()
static connector (arConnector $connector)
static raw ($set_raw=true)
static getArray ($key=NULL, $values=NULL)
static _toCamelCase ($str, $capitalise_first_char=false)

Protected Member Functions

 getActiveRecordFieldTypeFromMDB2 ($a_mdb2_type)
 initFieldList ()
 Get field list instance for ADT group.
- Protected Member Functions inherited from ActiveRecord
 serializeToCSV ($field)
 This method is called for every field of your instance if you use __asCsv.
 installDatabase ()

Protected Attributes

 $properties
 $fields
 $field_element_map
- Protected Attributes inherited from ActiveRecord
 $ar_safe_read = true
 $connector_container_name = ''

Additional Inherited Members

- Data Fields inherited from ActiveRecord
const ACTIVE_RECORD_VERSION = '2.0.7'
- Static Protected Member Functions inherited from ActiveRecord
static getCalledClass ()
static fromCamelCase ($str)

Detailed Description

ADT Active Record service wrapper class.

:TODO: EXPERIMENTAL!

This class expects a valid primary for all actions!

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 17 of file class.ilADTActiveRecordWrapper.php.

Constructor & Destructor Documentation

ilADTActiveRecordWrapper::__construct ( ilADTGroupActiveRecordBridge  $a_properties)

Constructor.

Parameters
ilADTGroupActiveRecordBridge$a_properties
Returns
self

Definition at line 29 of file class.ilADTActiveRecordWrapper.php.

References initFieldList().

{
$this->properties = $a_properties;
// see ActiveRecord::__construct();
$this->initFieldList();
$this->arConnector = new arConnectorDB();
}

+ Here is the call graph for this function:

Member Function Documentation

ilADTActiveRecordWrapper::getActiveRecordFieldTypeFromMDB2 (   $a_mdb2_type)
protected

Definition at line 43 of file class.ilADTActiveRecordWrapper.php.

References arField\FIELD_TYPE_DATE, arField\FIELD_TYPE_FLOAT, arField\FIELD_TYPE_INTEGER, FIELD_TYPE_TEXT, and arField\FIELD_TYPE_TIMESTAMP.

Referenced by initFieldList().

{
// currently they are all the same
switch($a_mdb2_type)
{
case "integer":
case "float":
case "text":
case "date":
case "timestamp":
case "integer":
/*
case "clob":
return arField::FIELD_TYPE_CLOB;
case "time":
return arField::FIELD_TYPE_TIME;
*/
}
}

+ Here is the caller graph for this function:

ilADTActiveRecordWrapper::getConnectorContainerName ( )
Returns
string Return the Name of your Connector Table

Reimplemented from ActiveRecord.

Definition at line 122 of file class.ilADTActiveRecordWrapper.php.

{
return $this->properties->getTableName();
}
ilADTActiveRecordWrapper::getPrimaryFieldValue ( )
Returns
mixed

Reimplemented from ActiveRecord.

Definition at line 132 of file class.ilADTActiveRecordWrapper.php.

{
$primary = array_shift($this->properties->getPrimary());
return $primary[1];
}
ilADTActiveRecordWrapper::initFieldList ( )
protected

Get field list instance for ADT group.

Definition at line 79 of file class.ilADTActiveRecordWrapper.php.

References $fields, fields, and getActiveRecordFieldTypeFromMDB2().

Referenced by __construct().

{
require_once "Services/ActiveRecord/classes/Fields/class.arFieldList.php";
$this->fields = new arFieldList();
// element => fields
$fields = array();
foreach($this->properties->getActiveRecordFields() as $element_id => $element_fields)
{
foreach($element_fields as $field)
{
$this->field_element_map[$field->getName()] = $element_id;
}
$fields = array_merge($fields, $element_fields);
}
$this->fields->setFields($fields);
// primary
if(sizeof($this->properties->getPrimary()) > 1)
{
throw new ilException("ilADTActiveRecordWrapper - no complex primary keys supported yet");
}
foreach($this->properties->getPrimary() as $primary_id => $primary_element)
{
$field = new arField();
$field->setHasField(true);
$field->setNotNull(true);
$field->setFieldType($this->getActiveRecordFieldTypeFromMDB2($primary_element[0]));
$field->setName($primary_id);
$this->fields->setPrimaryField($field);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilADTActiveRecordWrapper::returnDbTableName ( )
static
Returns
string Return the Name of your Database Table
Deprecated:

Reimplemented from ActiveRecord.

Definition at line 127 of file class.ilADTActiveRecordWrapper.php.

{
// :TODO: cannot be static
}
ilADTActiveRecordWrapper::sleep (   $field_name)
Parameters
$field_name
Returns
mixed

Reimplemented from ActiveRecord.

Definition at line 143 of file class.ilADTActiveRecordWrapper.php.

{
if(array_key_exists($field_name, $this->field_element_map))
{
$element = $this->properties->getElement($this->field_element_map[$field_name]);
return $element->getFieldValue($field_name);
}
// returning NULL would result in direct property access!
return false;
}
ilADTActiveRecordWrapper::wakeUp (   $field_name,
  $field_value 
)
Parameters
$field_name
$field_value
Returns
mixed

Reimplemented from ActiveRecord.

Definition at line 155 of file class.ilADTActiveRecordWrapper.php.

{
if(array_key_exists($field_name, $this->field_element_map))
{
$element = $this->properties->getElement($this->field_element_map[$field_name]);
return $element->setFieldValue($field_name, $field_value);
}
// returning NULL would result in direct property access!
return false;
}

Field Documentation

ilADTActiveRecordWrapper::$field_element_map
protected

Definition at line 21 of file class.ilADTActiveRecordWrapper.php.

ilADTActiveRecordWrapper::$fields
protected

Definition at line 20 of file class.ilADTActiveRecordWrapper.php.

Referenced by initFieldList().

ilADTActiveRecordWrapper::$properties
protected

Definition at line 19 of file class.ilADTActiveRecordWrapper.php.


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