lithium\data\model\Query::model()
Set or get the associated model.
Will also set the source table, i.e. $this->_config['source']
when setting the model.
Parameters
-
string|null
$model
Name of model to use, or
null
to retrieve current one.
Returns
string|QueryEither the current model name in use when $model is null
,
or the query itself when setting the model name.
Source
public function model($model = null) {
if (!$model) {
return $this->_config['model'];
}
$this->_config['model'] = $model;
$this->_config['source'] = $this->_config['source'] ?: $model::meta('source');
return $this;
}