\CGExtensionslookup_table

An abstract class for a generic lookup table.

This class manages a table, and it's items.

Summary

Methods
Properties
Constants
table_name()
get_addedit_formdata()
install()
uninstall()
validate()
save()
delete()
move_up()
move_down()
load()
load_all()
add()
exists()
get_list()
$name
$description
$id
No constants found
_insert()
_update()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$name

$name : string

Type

string

$description

$description : string

Type

string

$id

$id : integer

Type

integer

Methods

table_name()

table_name() : string

Return the table name.

uses late static bindings.

Returns

string

get_addedit_formdata()

get_addedit_formdata() : \CGExtensions\lookup_form_data

Return a title for the add/edit form.

uses late static bindings.

Returns

\CGExtensions\lookup_form_data

install()

install() 

Create the database table for this lookup table

uninstall()

uninstall() 

Destroy the database table for this lookup table.

validate()

validate() 

Validate the current lookup table to ensure we have the desired information

save()

save() 

Save this lookup table to the database

delete()

delete(integer  $item_id) 

Given an item id, delete it from the databas

Parameters

integer $item_id

move_up()

move_up(integer  $item_a_id) 

Move an item up amongst its peers.

This method automatically saves effected items to the databse.

Parameters

integer $item_a_id

move_down()

move_down(integer  $item_a_id) 

Move an item down amongst its peers.

This method automatically saves effected items to the databse.

Parameters

integer $item_a_id

load()

load(integer  $id) : object

load a lookup table item

Parameters

integer $id

The table id

Returns

object

load_all()

load_all() : array

Load all lookup table items

Returns

array —

an array of objects.

add()

add(string  $name, string  $description = null) 

Add a new lookup table item

Parameters

string $name
string $description

exists()

exists(integer  $id) : boolean

Test if an item exists by its id.

Parameters

integer $id

Returns

boolean

get_list()

get_list() : array

Get the items for a lookup table in a format that is suitable to use in a dropdown

Returns

array

_insert()

_insert() 

Insert a new lookup table into the database.

_update()

_update() 

Update an existing lookup table record.