/** Initializes base query for this model.
* @link http://agiletoolkit.org/doc/modeltable/dsql */
public function initQuery()
{
if (!$this->table) {
throw $this->exception('$table property must be defined');
}
$this->dsql = $this->db->dsql();
$this->dsql->debug($this->debug);
$this->dsql->table($this->table, $this->table_alias);
$this->dsql->default_field = $this->dsql->expr('*,' . $this->dsql->bt($this->table_alias ?: $this->table) . '.' . $this->dsql->bt($this->id_field));
$this->dsql->id_field = $this->id_field;
return $this;
}