FOF30\Factory\SwitchFactory::model PHP Method

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
    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);
        }
    }

Usage Example

コード例 #1
0
ファイル: SwitchFactoryTest.php プロジェクト: Joal01/fof
 /**
  * @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'));
 }
All Usage Examples Of FOF30\Factory\SwitchFactory::model