model() public method

Create a new Model object
public model ( string $viewName, array $config = [] ) : Model
$viewName string The name of the view we're getting a Model for.
$config array Optional MVC configuration values for the Model object.
return FOF30\Model\Model
Beispiel #1
0
 /**
  * @group           SwitchFactory
  * @covers          FOF30\Factory\SwitchFactory::model
  * @dataProvider    SwitchFactoryDataprovider::getTestModel
  */
 public function testModel($test, $check)
 {
     $msg = 'SwitchFactory::model %s - Case: ' . $check['case'];
     $platform = static::$container->platform;
     $platform::$isAdmin = $test['backend'];
     $factory = new SwitchFactory(static::$container);
     $result = $factory->model($test['view']);
     $this->assertEquals($check['result'], get_class($result), sprintf($msg, 'Returned the wrong result'));
 }
Beispiel #2
0
 /**
  * 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);
     }
 }
Beispiel #3
0
 /**
  * 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);
         // Let's pass the section override (if any)
         $magic->setSection($this->getSection());
         return $magic->make($viewName, $config);
     }
 }