b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Class: DataObjectCache

Source Location: /blogs/inc/_core/model/dataobjects/_dataobjectcache.class.php

Class DataObjectCache

Direct descendents
Child Class Description
SkinCache Skin Cache Class
FiletypeCache FiletypeCache Class
FileCache FileCache Class
WidgetCache Widget Cache Class
LinkCache LinkCache Class
ItemTypeCache ItemTypeCache Class
ItemCache Item Cache Class
UserCache Blog Cache Class
GenericCache GenericCache Class
BlogCache Blog Cache Class

[ Top ]
Property Summary
mixed   $all_loaded  
mixed   $cache   Object array by ID
mixed   $current_idx   Index of current iteration
array   $DataObject_array   NON indexed object array
mixed   $dbIDname  
mixed   $dbprefix  
mixed   $dbtablename  
mixed   $ID_array   List of object IDs.
mixed   $load_all  
mixed   $name_field  
string   $none_option_text   The text that gets used for the "None" option in the objects options list.
mixed   $none_option_value   The value that gets used for the "None" option in the objects options list.
mixed   $objtype   Class name of objects in this cache:
mixed   $order_by  
mixed   $shadow_cache   Copy of previous object array

[ Top ]
Method Summary
DataObjectCache   DataObjectCache()   Constructor
void   add()   Add a dataobject to the cache
void   clear()   Clear the cache **extensively**
boolean   dbdelete_by_ID()   Delete an object from DB by ID.
DataObject   &get_by_ID()   Get an object from cache by ID
reference   &get_by_name()   Get an object from cache by name
DataObject   &get_first()   This provides a simple interface for looping over the contents of the Cache.
array   get_ID_array()   Get an array of all (loaded) IDs.
array   get_list()   Get list of objects, referenced by list of IDs.
DataObject   &get_next()   This provides a simple interface for looping over the contents of the Cache.
string   get_option_array()   Returns option array with cache contents
string   get_option_list()   Returns form option list with cache contents
SQL   get_SQL_object()   Get base SQL object for queries.
Object   &instantiate()   Instantiate a DataObject from a table row and then cache it.
array   instantiate_list()  
void   load_all()   Load the cache **extensively**
array   load_by_sql()   Load a set of objects into the cache.
void   load_list()   Load a list of objects into the cache.
void   load_where()   Load a set of objects into the cache.
void   &new_obj()   Instanciate a new object within this cache
void   remove_by_ID()   Remove an object from cache by ID
void   rewind()   Rewind internal index to first position.

[ Top ]
Properties
mixed   $all_loaded = false [line 92]

[ Top ]
mixed   $cache = array() [line 71]

Object array by ID


[ Top ]
mixed   $current_idx = 0 [line 89]

Index of current iteration

API Tags:
See:  DataObjectCache::get_next()


[ Top ]
array   $DataObject_array = array() [line 83]

NON indexed object array


[ Top ]
mixed   $dbIDname [line 61]

[ Top ]
mixed   $dbprefix [line 60]

[ Top ]
mixed   $dbtablename [line 59]

[ Top ]
mixed   $ID_array [line 119]

List of object IDs.

API Tags:
See:  DataObjectCache::get_ID_array()
Access:  protected


[ Top ]
mixed   $load_all = false [line 91]

[ Top ]
mixed   $name_field [line 95]

[ Top ]
string   $none_option_text [line 105]

The text that gets used for the "None" option in the objects options list.

This is especially useful for i18n, because there are several "None"s!


[ Top ]
mixed   $none_option_value [line 112]

The value that gets used for the "None" option in the objects options list.


[ Top ]
mixed   $objtype [line 66]

Class name of objects in this cache:


[ Top ]
mixed   $order_by [line 96]

[ Top ]
mixed   $shadow_cache = NULL [line 77]

Copy of previous object array

API Tags:
See:  DataObjectCache::clear()


[ Top ]
Methods
Constructor DataObjectCache  [line 135]

  DataObjectCache DataObjectCache( string $objtype, boolean $load_all, string $tablename, [string $prefix = ''], string $dbIDname, [string $name_field = NULL], [string $order_by = ''], [string $allow_none_text = NULL], [mixed $allow_none_value = '']  )

Constructor

Parameters:
string   $objtype:  Name of DataObject class we are caching
boolean   $load_all:  true if it's OK to just load all items!
string   $tablename:  Name of table in database
string   $prefix:  Prefix of fields in the table
string   $dbIDname:  Name of the ID field (including prefix)
string   $name_field:  Name of the name field (including prefix)
string   $order_by:  field names or NULL to use name field
string   $allow_none_text:  The text that gets used for the "None" option in the objects options list (Default: T_('None')).
mixed   $allow_none_value:  The value that gets used for the "None" option in the objects options list.


[ Top ]
add  [line 336]

  void add( &$Obj  )

Add a dataobject to the cache

Parameters:
   &$Obj: 


Redefined in descendants as:

[ Top ]
clear  [line 426]

  void clear( [ $keep_shadow = false]  )

Clear the cache **extensively**

Parameters:
   $keep_shadow: 


Redefined in descendants as:

[ Top ]
dbdelete_by_ID  [line 649]

  boolean dbdelete_by_ID( integer $req_ID  )

Delete an object from DB by ID.

Parameters:
integer   $req_ID:  ID of object to delete


[ Top ]
get_by_ID  [line 509]

  DataObject &get_by_ID( integer $req_ID, [boolean $halt_on_error = true], [boolean $halt_on_empty = true]  )

Get an object from cache by ID

Load the cache if necessary (all at once if allowed).

Parameters:
integer   $req_ID:  ID of object to load
boolean   $halt_on_error:  true if function should die on error
boolean   $halt_on_empty:  true if function should die on empty/null

API Tags:
Return:  reference on cached object or NULL if not found


Redefined in descendants as:

[ Top ]
get_by_name  [line 579]

  reference &get_by_name( integer $req_name, [boolean $halt_on_error = true], [boolean $halt_on_empty = true]  )

Get an object from cache by name

Load the cache if necessary (all at once if allowed).

Parameters:
integer   $req_name:  ID of object to load
boolean   $halt_on_error:  true if function should die on error
boolean   $halt_on_empty:  true if function should die on empty/null

API Tags:
Return:  on cached object


[ Top ]
get_first  [line 455]

  DataObject &get_first( )

This provides a simple interface for looping over the contents of the Cache.

This should only be used for basic enumeration. If you need complex filtering of the cache contents, you should probably use a DataObjectList instead.


API Tags:
See:  DataObject::get_next()


[ Top ]
get_ID_array  [line 318]

  array get_ID_array( )

Get an array of all (loaded) IDs.



[ Top ]
get_list  [line 301]

  array get_list( array $ids  )

Get list of objects, referenced by list of IDs.

Parameters:
array   $ids: 


[ Top ]
get_next  [line 484]

  DataObject &get_next( )

This provides a simple interface for looping over the contents of the Cache.

This should only be used for basic enumeration. If you need complex filtering of the cache contents, you should probably use a DataObjectList instead.


API Tags:
See:  DataObject::get_first()


[ Top ]
get_option_array  [line 729]

  string get_option_array( [string $method = 'get_name'], [array $ignore_IDs = array()]  )

Returns option array with cache contents

Load the cache if necessary

Parameters:
string   $method:  Callback method name
array   $ignore_IDs:  IDs to ignore.


Redefined in descendants as:

[ Top ]
get_option_list  [line 679]

  string get_option_list( [integer $default = 0], [boolean $allow_none = false], [string $method = 'get_name'], [array $ignore_IDs = array()]  )

Returns form option list with cache contents

Load the cache if necessary

Parameters:
integer   $default:  selected ID
boolean   $allow_none:  provide a choice for "none" with ID ''
string   $method:  Callback method name
array   $ignore_IDs:  IDs to ignore.


Redefined in descendants as:

[ Top ]
get_SQL_object  [line 286]

  SQL get_SQL_object( [string $title = NULL]  )

Get base SQL object for queries.

This gets used internally and is a convenient method for derived caches to override SELECT behaviour.

Parameters:
string   $title:  Optional query title


[ Top ]
instantiate  [line 372]

  Object &instantiate( Object &$db_row  )

Instantiate a DataObject from a table row and then cache it.

Parameters:
Object   &$db_row:  Database row


Redefined in descendants as:

[ Top ]
instantiate_list  [line 411]

  array instantiate_list( array $db_rows  )

Parameters:
array   $db_rows:  List of DB rows

API Tags:
Return:  List of DataObjects
Access:  public


[ Top ]
load_all  [line 189]

  void load_all( )

Load the cache **extensively**



[ Top ]
load_by_sql  [line 258]

  array load_by_sql( SQL $SQL  )

Load a set of objects into the cache.

Already loaded objects get excluded via "NOT IN()"

Parameters:
SQL   $SQL:  SQL object

API Tags:
Return:  List of DataObjects


[ Top ]
load_list  [line 221]

  void load_list( array $req_list, [boolean $invert = false]  )

Load a list of objects into the cache.

Parameters:
array   $req_list:  List of IDs of objects to load
boolean   $invert:  Invert list: Load all objects except those listed in the first parameter


[ Top ]
load_where  [line 243]

  void load_where( string $sql_where  )

Load a set of objects into the cache.

Parameters:
string   $sql_where:  SQL where expression


[ Top ]
new_obj  [line 175]

  void &new_obj( [ $row = NULL]  )

Instanciate a new object within this cache

Parameters:
   $row: 


Redefined in descendants as:

[ Top ]
remove_by_ID  [line 634]

  void remove_by_ID( integer $req_ID  )

Remove an object from cache by ID

Parameters:
integer   $req_ID:  ID of object to remove


Redefined in descendants as:

[ Top ]
rewind  [line 468]

  void rewind( )

Rewind internal index to first position.


API Tags:
Access:  public


[ Top ]

Documentation generated on Sat, 06 Mar 2010 04:07:51 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).