Base Database Model

It is a method to get the model name. By default, the model name is parsed using the classname or it can be set by passing a $config['name'] in the class constructor.

  • return string - The name of the model
public function getName()
{
if (empty($this->name))
{
$r = null;

if (!preg_match('/Model(.*)/i', get_class($this), $r))
{
throw new \Exception(\JText::_('JLIB_APPLICATION_ERROR_MODEL_GET_NAME'), 500);
}

$this->name = strtolower($r[1]);
}

return $this->name;
}