FOF30\View\View::getModel PHP Method

getModel() public method

Returns a named Model object
public getModel ( string $name = null ) : Model
$name string The Model name. If null we'll use the modelName variable or, if it's empty, the same name as the Controller
return FOF30\Model\Model The instance of the Model known to this Controller
    public function getModel($name = null)
    {
        if (!empty($name)) {
            $modelName = $name;
        } elseif (!empty($this->defaultModel)) {
            $modelName = $this->defaultModel;
        } else {
            $modelName = $this->name;
        }
        if (!array_key_exists($modelName, $this->modelInstances)) {
            throw new ModelNotFound($modelName, $this->name);
        }
        return $this->modelInstances[$modelName];
    }