FOF30\Controller\DataController::getModel PHP Méthode

getModel() public méthode

Returns a named Model object. Makes sure that the Model is a database-aware model, throwing an exception otherwise, when $name is null.
public getModel ( string $name = null, array $config = [] ) : DataModel
$name string The Model name. If null we'll use the modelName variable or, if it's empty, the same name as the Controller
$config array Configuration parameters to the Model. If skipped we will use $this->config
Résultat FOF30\Model\DataModel The instance of the Model known to this Controller
    public function getModel($name = null, $config = array())
    {
        $model = parent::getModel($name, $config);
        if (is_null($name) && !$model instanceof DataModel) {
            throw new NotADataModel('Model ' . get_class($model) . ' is not a database-aware Model');
        }
        return $model;
    }