Class InfoRecords

Description

Implements interfaces:

Habari InfoRecords Class

Base class for managing metadata about various Habari objects

  • abstract:

Located in /system/classes/inforecords.php (line 10)


	
			
Direct descendents
Class Description
UserInfo
PostInfo Habari InfoRecords Class
CommentInfo Habari InfoRecords Class
InfoObject Habari InfoRecords Class
Variable Summary
Method Summary
InfoRecords __construct (string $table_name, string $key_name, [mixed $key_value = NULL])
void commit ([mixed $metadata_key = null])
boolean delete_all ()
array get_url_args ()
boolean is_key_set ()
void set_key (mixed $metadata_key)
void _load ()
mixed __get (string $name)
boolean __isset (string $name)
void __set (string $name, mixed $value)
boolean __unset (string $name)
Variables
mixed $url_args (line 23)
  • access: protected
mixed $_key_name (line 17)
  • access: protected
mixed $_key_value (line 19)
  • access: protected
mixed $_loaded = FALSE (line 21)
  • access: protected
mixed $_table_name (line 15)
  • access: protected
mixed $__inforecord_array = array() (line 13)
  • access: protected
Methods
Constructor __construct (line 37)

Takes three parameters. The table of the options table, the name of the master key and the record_id for which options are managed.

posts take a slug as a record_id, comments take a comment_id and users take a user_id (user_name)

IMPORTANT: if <tt>$primary_key_value</tt> is not set in the constructor, set_key MUST be called before inforecords can be set. Or bad things (think swarms of locusts o'er the land) will happen

  • access: public
InfoRecords __construct (string $table_name, string $key_name, [mixed $key_value = NULL])
  • string $table_name: name of the table to insert info (use the DB::o()->table_name syntax)
  • string $key_name: name of the primary key (for example "post_id")
  • mixed $key_value: (optional) the master record key value (for example, info for post_id = 1 managed by setting this param to 1). Use set_key method if not set here.

Redefined in descendants as:
commit (line 206)

Commit all of the changed info options to the database.

If this function is not called, then the options will not be written.

  • access: public
void commit ([mixed $metadata_key = null])
  • mixed $metadata_key: (optional) Key to use when writing info data.
delete_all (line 181)

Remove all info options. Primarily used when deleting the parent object.

I.E. when deleting a user, the delete method would call this.

  • return: TRUE if the options were successfully unset, FALSE otherwise
  • access: public
boolean delete_all ()
get_url_args (line 166)

Returns a set of properties used by URL::get to create URLs

  • return: Properties of this post used to build a URL
  • access: public
array get_url_args ()

Implementation of:
URLProperties::get_url_args()
is_key_set (line 50)

Test if the master record value has been set (and thus, safe to set info records).

  • return: TRUE if master record value has been set already, FALSE otherwise
  • access: public
boolean is_key_set ()
set_key (line 62)

function set_key For use in cases where the master record key is not known at the time of object instantiation (ie: a new post)

  • access: public
void set_key (mixed $metadata_key)
  • mixed $metadata_key: the id of the master record (could be int or string, most likely int)
_load (line 70)

Populate the internal hashmap with the values from the DB.

  • access: protected
void _load ()
__get (line 111)

Fetch info record value.

  • return: Stored value for specified key
  • access: public
mixed __get (string $name)
  • string $name: Name of the key to get
__isset (line 139)

Test for the existence of specified info value

  • return: TRUE if the info option exists, FALSE in all other cases
  • access: public
boolean __isset (string $name)
  • string $name: Name of the option to set
__set (line 127)

Update the info record.

The value will not be stored in the database until calling $this->commit();

  • access: public
void __set (string $name, mixed $value)
  • string $name: Name of the key to set
  • mixed $value: Value to set
__unset (line 151)

Remove an info option; immediately unsets from the storage AND removes from database. Use with caution.

  • return: TRUE if the option is successfully unset, FALSE otherwise
  • access: public
boolean __unset (string $name)
  • string $name: Name of the option to unset

Documentation generated on Thu, 30 Oct 2008 20:31:19 +0100 by phpDocumentor 1.3.2