From: Nicolas Boisselier Date: Wed, 16 Dec 2015 19:35:35 +0000 (+0000) Subject: sort and extras in db.yaml X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=cbd3a75c562b6e1ae797aeac291b8fa40be793e7;p=nb.git sort and extras in db.yaml --- diff --git a/lib/php/db/table.php b/lib/php/db/table.php index d07bb0cd..cd58204b 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -41,7 +41,7 @@ class table extends nb { $this->db = new db(); } - // Table could be a select + // Name, could be a select if (stripos($name,'SELECT ')===0) { #$temp = '_'.substr(md5($name),0,6); $temp = '_query_'; @@ -53,7 +53,23 @@ class table extends nb { $this->name = $name; - if (isset($opt['extras'])) $this->add_extras($opt['extras']); + // Extras + if (isset($opt['extras'])) { + $this->add_extras($opt['extras']); + + } elseif ( + isset($this->db->extras) + and isset($this->db->extras[$this->name]) + ) { + $this->add_extras($this->db->extras[$this->name]); + + } + + // Sort + if ( + isset($this->db->sort) + and isset($this->db->sort[$this->name]) + ) $this->db->pset('sort',$this->db->sort[$this->name]); return $this->fields(); }