Skip to content

Instantly share code, notes, and snippets.

@jpalala
Forked from adin234/mode.php
Last active August 29, 2015 14:18
Show Gist options
  • Save jpalala/d62c25f8efc3474d161f to your computer and use it in GitHub Desktop.
Save jpalala/d62c25f8efc3474d161f to your computer and use it in GitHub Desktop.
Eden PHP Model how-to
<?php
/* MODEL */
class Some_Model extends Eden_Sql_model {
protected $_table = 'some_table';
public function __construct($database = null) {
$this->_database = $database ? $database : front()->database();
//do some other things here
}
}
/* BACK CONTROLLER */
class Some_Back_Page_Controller extends Back_Page {
public function render() {
$some_model = new Some_Model(back()->database());
return $this->_page();
}
}
/* FRONT CONTROLLER */
class Some_Front_Page_Controller extends Front_Page {
public function render() {
$some_model = new Some_Model();
return $this->_page();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment