FOF30\View\View::getModel PHP 메소드

getModel() 공개 메소드

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
리턴 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];
    }