PHP Class Habari\QueryRecord

Inheritance: implements habari\URLProperties
Show file Open project: habari/system

Protected Properties

Property Type Description
$fields
$newfields Holds field values from db
$unsetfields Holds updated field values to commit to db

Public Methods

Method Description
__construct ( array $paramarray = [] ) constructor __construct Constructor for the QueryRecord class.
__get ( string $name ) : mixed function __get Handles getting virtual properties for this class
__isset ( string $name ) : boolean Magic isset for QueryRecord, returns whether a property value is set.
__set ( string $name, mixed $value ) : mixed function __set Handles setting virtual properties for this class
delete ( ) This is the public interface that deletes a record
exclude_fields ( mixed $fields ) Registers a (list of) fields(s) as being managed exclusively by the database.
get_raw_field ( string $name ) : mixed A field accessor that doesn't filter, for use in plugins that filter field values
get_url_args ( ) : array Returns an array with the current field settings
insert ( ) This is the public interface that inserts a record
jsonSerialize ( ) : string Implements JsonSerializable, only available in PHP 5.4 :(
list_excluded_fields ( ) : array returns an array of fields that should not be included in any database insert operation
modify ( $paramarray = [] ) This is the public interface to update a record with an array
to_array ( ) : array function to_array Returns an array with the current field settings
to_json ( ) : string Convert record data to json Returns a string with the current field values in JSON format
update ( ) This is the public interface that updates a record

Protected Methods

Method Description
deleteRecord ( string $table, array $updatekeyfields ) : boolean function deleteRecord Deletes a record based on the match array
insertRecord ( string $table, null | array $schema = null ) : integer function insertRecord( Inserts this record's fields as a new row
updateRecord ( string $table, array $updatekeyfields = [], null | array $schema = null ) : boolean function updateRecord Updates this record's fields using the new data

Method Details

__construct() public method

constructor __construct Constructor for the QueryRecord class.
public __construct ( array $paramarray = [] )
$paramarray array an associative array of initial field values.

__get() public method

function __get Handles getting virtual properties for this class
public __get ( string $name ) : mixed
$name string Name of the property
return mixed The set value or null if none exists

__isset() public method

Magic isset for QueryRecord, returns whether a property value is set.
public __isset ( string $name ) : boolean
$name string The name of the parameter
return boolean True if the value is set, false if not

__set() public method

function __set Handles setting virtual properties for this class
public __set ( string $name, mixed $value ) : mixed
$name string Name of the property
$value mixed Value to set it to
return mixed The set value

delete() public method

This is the public interface that deletes a record
public delete ( )

deleteRecord() protected method

function deleteRecord Deletes a record based on the match array
protected deleteRecord ( string $table, array $updatekeyfields ) : boolean
$table string Table to delete from
$updatekeyfields array An associative array of field data to match
return boolean True on success, false if not

exclude_fields() public method

Registers a (list of) fields(s) as being managed exclusively by the database.
public exclude_fields ( mixed $fields )
$fields mixed A database field name (string) or an array of field names

get_raw_field() public method

A field accessor that doesn't filter, for use in plugins that filter field values
public get_raw_field ( string $name ) : mixed
$name string Name of the field to get
return mixed Value of the field, unfiltered

get_url_args() public method

Returns an array with the current field settings
public get_url_args ( ) : array
return array The field settings as they would be saved

insert() public method

This is the public interface that inserts a record
public insert ( )

insertRecord() protected method

function insertRecord( Inserts this record's fields as a new row
protected insertRecord ( string $table, null | array $schema = null ) : integer
$table string Table to update, use table name without prefix and without braces
$schema null | array An array describing the schema of auxiliary tables
return integer The inserted record id on success, false if not Again, the parent class's method's signature must match that of the child class's signature

jsonSerialize() public method

Implements JsonSerializable, only available in PHP 5.4 :(
public jsonSerialize ( ) : string
return string

list_excluded_fields() public method

returns an array of fields that should not be included in any database insert operation
public list_excluded_fields ( ) : array
return array an array of field names

modify() public method

This is the public interface to update a record with an array
public modify ( $paramarray = [] )

to_array() public method

function to_array Returns an array with the current field settings
public to_array ( ) : array
return array The field settings as they would be saved

to_json() public method

Convert record data to json Returns a string with the current field values in JSON format
public to_json ( ) : string
return string The field settings as they would be saved in JSON

update() public method

This is the public interface that updates a record
public update ( )

updateRecord() protected method

function updateRecord Updates this record's fields using the new data
protected updateRecord ( string $table, array $updatekeyfields = [], null | array $schema = null ) : boolean
$table string Table to update, use table name without prefix and without braces
$updatekeyfields array An associative array of field data to match
$schema null | array An array describing the schema of auxiliary tables
return boolean True on success, false if not

Property Details

$fields protected property

protected $fields

$newfields protected property

Holds field values from db
protected $newfields

$unsetfields protected property

Holds updated field values to commit to db
protected $unsetfields