Back to BaseController class

Method createModel

protected \Joomla\CMS\MVC\Model\BaseDatabaseModel|bool
createModel
(mixed $name, mixed $prefix = '', mixed $config = array())
Method to load and return a model object.
Parameters
  • string $name The name of the model.
  • string $prefix Optional model prefix.
  • array $config Configuration array for the model. Optional.
Returns
  • \Joomla\CMS\MVC\Model\BaseDatabaseModel|bool Model object on success; otherwise false on failure.
Since
  • 3.0

Method createModel - Source code

/**
 * Method to load and return a model object.
 *
 * @param   string  $name    The name of the model.
 * @param   string  $prefix  Optional model prefix.
 * @param   array   $config  Configuration array for the model. Optional.
 *
 * @return  BaseDatabaseModel|boolean   Model object on success; otherwise false on failure.
 *
 * @since   3.0
 */
protected function createModel($name, $prefix = '', $config = array())
{
    $model = $this->factory->createModel($name, $prefix, $config);
    if ($model === null) {
        return false;
    }
    return $model;
}