/** * 設定索引物件 * @param Generic_object $obj * @return Generic_collection */ public function set_index_object(Generic_object $obj) { $this->index_object = $obj; $this->id = $obj->get_id(); $this->is_loaded = FALSE; return $this; }
/** * 查詢現在物件的數量 * * 用來作單一約束的檢查 * @param Generic_object $go * @param string $where * @return int */ protected static function _get_result_num(Generic_object $go, $where) { $go->db->where($where)->from($go->table_name); if (is_int($go->get_id())) { $go->db->where_not_in(self::_get_pk($go->primary_key, $go->table_name), $go->get_id()); } if (is_string($go->fake_delete)) { $go->db->where($go->fake_delete, 'FALSE'); } $result_num = $go->db->count_all_results(); return $result_num; }