public function loadById($model, $id)
{
$dsql = $this->dsql($model);
$p = '';
if ($model->_references) {
$p = ($model->table_alias ?: $model->table) . '.';
}
if (is_null($id)) {
throw $this->exception('ID is specified as null');
}
$dsql->where($p . $model->id_field, $id);
return $this->load($model, $dsql);
}