It is a method to add a model to the view. Joomla supports a multiple-model single view system by which models are referenced by classname. A caveat to the classname referencing is that any classname prepended by \JModel will be referenced by the name without \JModel. For example, \JModelCategory is just Category.
- \JModelLegacy $model - The model to add to the view.
- boolean $default - Is this the default model?
- return \JModelLegacy - The added model.
public function setModel($model, $default = false)
$name = strtolower($model->getName());
$this->_models[$name] = $model;
$this->_defaultModel = $name;