コード例 #1
0
ファイル: Select.php プロジェクト: Konro1/pms
 public function compile($db = NULL)
 {
     if ($db === NULL and $this->meta()) {
         $db = Database::instance($this->meta()->db());
     }
     $original_select = $this->_select;
     $original_from = $this->_from;
     if (empty($this->_from)) {
         $this->_from[] = $this->meta()->model();
     }
     if (empty($this->_select)) {
         $this->_select[] = $this->meta()->table() . '.*';
     }
     foreach ($this->_from as &$from) {
         $from = Jam_Query_Builder::resolve_table_alias($from);
     }
     foreach ($this->_select as &$attribute) {
         $attribute = Jam_Query_Builder::resolve_attribute_name($attribute, $this->meta()->model());
     }
     $this->meta()->events()->trigger('builder.before_select', $this);
     $result = parent::compile($db);
     $this->meta()->events()->trigger('builder.after_select', $this);
     $this->_select = $original_select;
     $this->_from = $original_from;
     return $result;
 }