PHP 클래스 Habari\InfoRecords

Base class for managing metadata about various Habari objects
상속: implements habari\URLProperties
파일 보기 프로젝트 열기: habari/system

보호된 프로퍼티들

프로퍼티 타입 설명
$__inforecord_array the info array
$_dirty set to true if any values here have been changed but not saved
$_key_name name of the primary key in the info record table
$_key_value value of the primary key - the master record
$_loaded set to true only when the inforecords have been loaded
$_table_name table which contains the info records
$url_args

공개 메소드들

메소드 설명
__construct ( string $table_name, string $key_name, mixed $key_value = null ) Takes three parameters. The table of the options table, the name of the master key and the record_id for which options are managed.
__get ( string $name ) : mixed Fetch info record value.
__isset ( string $name ) : boolean Test for the existence of specified info value
__set ( string $name, mixed $value ) Update the info record.
__unset ( string $name ) : boolean Remove an info option; immediately unsets from the storage AND removes from database. Use with caution.
commit ( mixed $metadata_key = null ) : boolean Commit all of the changed info options to the database.
count ( ) : integer Get the number of info records
delete_all ( ) : boolean Remove all info options. Primarily used when deleting the parent object.
getArrayCopy ( )
get_url_args ( ) : array Returns a set of properties used by URL::get to create URLs
is_key_set ( ) : boolean Test if the master record value has been set (and thus, safe to set info records).
set_key ( mixed $metadata_key ) 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)

보호된 메소드들

메소드 설명
_load ( ) Populate the internal hashmap with the values from the DB.

메소드 상세

__construct() 공개 메소드

posts take a slug as a record_id, comments take a comment_id and users take a user_id (user_name) IMPORTANT: if $primary_key_value 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
public __construct ( string $table_name, string $key_name, mixed $key_value = null )
$table_name string name of the table to insert info (use the DB::o()->table_name syntax)
$key_name string name of the primary key (for example "post_id")
$key_value mixed (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.

__get() 공개 메소드

Fetch info record value.
public __get ( string $name ) : mixed
$name string Name of the key to get
리턴 mixed Stored value for specified key

__isset() 공개 메소드

Test for the existence of specified info value
public __isset ( string $name ) : boolean
$name string Name of the option to set
리턴 boolean true if the info option exists, false in all other cases

__set() 공개 메소드

The value will not be stored in the database until calling $this->commit();
public __set ( string $name, mixed $value )
$name string Name of the key to set
$value mixed Value to set

__unset() 공개 메소드

Remove an info option; immediately unsets from the storage AND removes from database. Use with caution.
public __unset ( string $name ) : boolean
$name string Name of the option to unset
리턴 boolean true if the option is successfully unset, false otherwise

_load() 보호된 메소드

Populate the internal hashmap with the values from the DB.
protected _load ( )

commit() 공개 메소드

If this function is not called, then the options will not be written.
public commit ( mixed $metadata_key = null ) : boolean
$metadata_key mixed (optional) Key to use when writing info data.
리턴 boolean True if the commit succeeded.

count() 공개 메소드

Get the number of info records
public count ( ) : integer
리턴 integer Number of info records here

delete_all() 공개 메소드

I.E. when deleting a user, the delete method would call this.
public delete_all ( ) : boolean
리턴 boolean true if the options were successfully unset, false otherwise

getArrayCopy() 공개 메소드

public getArrayCopy ( )

get_url_args() 공개 메소드

Returns a set of properties used by URL::get to create URLs
public get_url_args ( ) : array
리턴 array Properties of this post used to build a URL

is_key_set() 공개 메소드

Test if the master record value has been set (and thus, safe to set info records).
public is_key_set ( ) : boolean
리턴 boolean true if master record value has been set already, false otherwise

set_key() 공개 메소드

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)
public set_key ( mixed $metadata_key )
$metadata_key mixed the id of the master record (could be int or string, most likely int)

프로퍼티 상세

$__inforecord_array 보호되어 있는 프로퍼티

the info array
protected $__inforecord_array

$_dirty 보호되어 있는 프로퍼티

set to true if any values here have been changed but not saved
protected $_dirty

$_key_name 보호되어 있는 프로퍼티

name of the primary key in the info record table
protected $_key_name

$_key_value 보호되어 있는 프로퍼티

value of the primary key - the master record
protected $_key_value

$_loaded 보호되어 있는 프로퍼티

set to true only when the inforecords have been loaded
protected $_loaded

$_table_name 보호되어 있는 프로퍼티

table which contains the info records
protected $_table_name

$url_args 보호되어 있는 프로퍼티

protected $url_args