/** * Create a new Model object * * @param string $viewName The name of the view we're getting a Model for. * @param array $config Optional MVC configuration values for the Model object. * * @return Model */ public function model($viewName, array $config = array()) { try { return parent::model($viewName, $config); } catch (ModelNotFound $e) { $magic = new Magic\ModelFactory($this->container); return $magic->make($viewName, $config); } }
/** * Create a new Model object * * @param string $viewName The name of the view we're getting a Model for. * @param array $config Optional MVC configuration values for the Model object. * * @return Model */ public function model($viewName, array $config = array()) { try { return parent::model($viewName, $config); } catch (ModelNotFound $e) { } $modelClass = $this->container->getNamespacePrefix('inverse') . 'Model\\' . ucfirst($viewName); try { return $this->createModel($modelClass, $config); } catch (ModelNotFound $e) { $modelClass = $this->container->getNamespacePrefix('inverse') . 'Model\\' . ucfirst($this->container->inflector->singularize($viewName)); return $this->createModel($modelClass, $config); } }