/** * fromModel * * @param Model $model * @param string $suffix * * @return string * * @throws \Exception */ public static function fromModel(Model $model, $suffix = null) { $suffix = $suffix ? '.' . trim($suffix, '.') : null; return $model->getOption() . '.' . $model->getName() . $suffix; }
/** * Method to add a model to the view. We support a multiple model single * view system by which models are referenced by classname. * * @param Model $model The model to add to the view. * @param boolean $default Is this the default model? * * @return object The added model. */ public function setModel(Model $model, $default = false) { $name = strtolower($model->getName()); $this->model[$name] = $model; if ($default) { $this->defaultModel = $name; } return $model; }