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. |
Add a dataobject to the cache
Parameters:
Redefined in descendants as:
void clear(
[
$keep_shadow = false]
)
|
|
Clear the cache **extensively**
Parameters:
Redefined in descendants as:
boolean dbdelete_by_ID(
integer
$req_ID
)
|
|
Delete an object from DB by ID.
Parameters:
|
integer |
$req_ID: |
ID of object to delete |
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:
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:
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() |
Get an array of all (loaded) IDs.
array get_list(
array
$ids
)
|
|
Get list of objects, referenced by list of IDs.
Parameters:
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() |
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:
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:
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 |
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:
array instantiate_list(
array
$db_rows
)
|
|
Parameters:
|
array |
$db_rows: |
List of DB rows |
API Tags:
| Return: | List of DataObjects |
| Access: | public |
Load the cache **extensively**
array load_by_sql(
SQL
$SQL
)
|
|
Load a set of objects into the cache.
Already loaded objects get excluded via "NOT IN()"
Parameters:
API Tags:
| Return: | List of DataObjects |
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 |
void load_where(
string
$sql_where
)
|
|
Load a set of objects into the cache.
Parameters:
|
string |
$sql_where: |
SQL where expression |
void &new_obj(
[
$row = NULL]
)
|
|
Instanciate a new object within this cache
Parameters:
Redefined in descendants as:
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:
Rewind internal index to first position.
API Tags: