diff options
author | Filipp Lepalaan <filipp@mac.com> | 2010-05-22 01:09:22 +0300 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2010-05-22 01:09:22 +0300 |
commit | a42c754c31761767cd1ca6dcfe416671409f5435 (patch) | |
tree | d4746a5b9c5b0764fc3c9ada045097f5b632d6af /MainController.php | |
parent | 8ec4e59bb0ddac89f36dcb48ee3f14c737e6e80f (diff) | |
download | main-a42c754c31761767cd1ca6dcfe416671409f5435.tar.gz main-a42c754c31761767cd1ca6dcfe416671409f5435.tar.bz2 main-a42c754c31761767cd1ca6dcfe416671409f5435.zip |
Fix
Diffstat (limited to 'MainController.php')
-rw-r--r-- | MainController.php | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/MainController.php b/MainController.php index e1545b7..ed8d5e6 100644 --- a/MainController.php +++ b/MainController.php @@ -8,16 +8,16 @@ class MainController public $pageTitle = ''; // Title of the rendered page public $defaultAction = ''; // Method to run when none specified - const OrderBy = ""; - const HasMany = ""; - const TableName = ""; - const ManyToMany = ""; - const ForeignKey = ""; - const TableSelect = ""; + const OrderBy = ''; + const HasMany = ''; + const TableName = ''; + const ManyToMany = ''; + const ForeignKey = ''; + const TableSelect = ''; function __construct($id = null) { - // Child classes should always have the same name as their tables + // child classes should always have the same name as their tables $this->class = get_class($this); $this->table = eval("return {$this->class}::TableName;"); @@ -38,9 +38,8 @@ class MainController } - /** - * Get One Thing - */ + //// + // Get One Thing public function get($where) { if (!is_array($where)) { @@ -62,7 +61,7 @@ class MainController */ public function find($where = null, $sort = false, $limit = false) { - $select = "*"; $q = ""; + $select = '*'; $q = ''; // Allow custom queries if (is_array($where)) @@ -70,18 +69,18 @@ class MainController foreach ($where as $k => $v) { $values[] = $v; - $args = explode(" ", $k); + $args = explode(' ', $k); $col = array_shift($args); - $op = implode(" ", $args); + $op = implode(' ', $args); // No column name given, default to "id" if (empty($col)) { - $col = "id"; + $col = 'id'; } // No operator given, default to "=" if (empty($op)) { - $op = "="; + $op = '='; } $tmp = (empty($q)) ? ' WHERE ' : ' AND '; @@ -94,7 +93,7 @@ class MainController } if ($where == null) { - $q = "WHERE ?"; + $q = 'WHERE ?'; $values = array(1); } |