Back to AbstractView class

Method getModel

public \Joomla\CMS\MVC\Model\BaseDatabaseModel
getModel
(mixed $name = null)
Method to get the model object
Parameters
  • string $name The name of the model (optional)
Returns
  • \Joomla\CMS\MVC\Model\BaseDatabaseModel The model object
Since
  • 3.0
Class: AbstractView
Project: Joomla

Method getModel - Source code

/**
 * Method to get the model object
 *
 * @param   string  $name  The name of the model (optional)
 *
 * @return  BaseDatabaseModel  The model object
 *
 * @since   3.0
 */
public function getModel($name = null)
{
    if ($name === null) {
        $name = $this->_defaultModel;
    }
    return $this->_models[strtolower($name)];
}