Back to BaseModel class

Method __construct

public
__construct
(mixed $config = array())
Constructor
Parameters
  • array $config An array of configuration options (name, state, ignore_request).
Since
  • 4.0.0
-
  • \Exception
Class: BaseModel
Project: Joomla

Method __construct - Source code

/**
 * Constructor
 *
 * @param   array  $config  An array of configuration options (name, state, ignore_request).
 *
 * @since   4.0.0
 * @throws  \Exception
 */
public function __construct($config = array())
{
    // Set the view name
    if (empty($this->name)) {
        if (\array_key_exists('name', $config)) {
            $this->name = $config['name'];
        } else {
            $this->name = $this->getName();
        }
    }
    // Set the model state
    if (\array_key_exists('state', $config)) {
        $this->state = $config['state'];
    }
    // Set the internal state marker - used to ignore setting state from the request
    if (!empty($config['ignore_request'])) {
        $this->__state_set = true;
    }
}