class Models_Example extends Models_Base {
* N.B.: Put the exact names of the columns as these are accessed literally
* in the base class's fetching code (e.g. fromArray()).
protected $database_name = DATABASE_NAME;
protected $table_name = "example";
protected $primary_key = "example_id"; // Name of primary key column in the database. The "closest thing to a standard" is to name primary key columns table_name_singular_id, e.g. "events.event_id".
protected $default_sort_column = "title";
public function __construct($arr = NULL) {
parent::__construct($arr);
* @return The primary key of the record represented by this model.
public function getID() {
return $this->example_id;
public function setActive($active) {
public function getActive() {
public function setTitle($title) {
public function getTitle() {
public static function fetchRowByID($example_id, $active = 1) {
return $self->fetchRow($constraints);
public static function fetchAllByActive($active = 1) {
return $self->fetchAll($constraints);