Model Factory.

@throws \Exception

@return mixed
356092
public function getModel()
    {
        $namePath = $this->getModelClass();
        $model = new $namePath();

        if (!($model instanceof EntityDataModel)) {
            throw new \Exception($this->valueClass.' is not an instance of EntityModel.');
        }

        return $model;
    }
432779
protected function modelFactory()
    {
        if (!isset($this->modelFactory)) {
            throw new RuntimeException(sprintf(
                'Model Factory is not defined for "%s"',
                get_class($this)
            ));
        }

        return $this->modelFactory;
    }
136245
protected function getModel()
    {
        if (! $this->model) {
            $this->model = $this->createModel();

            $this->prepareModel($this->model);
        }

        return $this->model;
    }
444859
protected function getServiceByFactory() {
		if ($this->arguments === null) {
			return $this->initService();
		}

		$args = $this->normalizeArgs($this->arguments);
		$args = $this->processArgs($args);
		
		return $this->initService($args);
	}
564533
public function pivotModel()
    {
        if (!isset($this->pivotModel)) {
            $this->pivotModel = $this->modelFactory()->get(Join::class);
        }

        return $this->pivotModel;
    }
498649
public function getQueueFactory(): ?Factory
    {
        if (!$this->hasQueueFactory()) {
            $this->setQueueFactory($this->getDefaultQueueFactory());
        }
        return $this->queueFactory;
    }
443545
public function cliAction()
    {
        $exitCode = $this->cliApplication->run(new RequestInput($this->getRequest()), $this->output);

        if (is_numeric($exitCode)) {
            $model = new ViewModel();
            $model->setErrorLevel($exitCode);

            return $model;
        }
    }
1213454
protected function createDefaultFactory()
    {
        $loader = $this->loader ? : $this->createDefaultLoader();
        if ($this->hierarchy) {
            $loader = new HierarchicalNameLoader($loader);
        }
        $rootAdapter = $this->fallbackAdapter ? : $this->createDefaultFallbackAdapter();

        return new AdapterLoaderFactory($loader, $rootAdapter);
    }
510975
protected function initializeModelRepository()
    {
        /** @var ModelRepositoryFactoryInterface $factory */
        $factory = app(ModelRepositoryFactoryInterface::class);

        $this->modelRepository = $factory->make($this->modelInformation->modelClass());

        $this->applyRepositoryContext();

        return $this;
    }
586194
protected function structureModelFactory()
    {
        if (!isset($this->structureModelFactory)) {
            throw new RuntimeException(sprintf(
                'Model Factory is not defined for "%s"',
                get_class($this)
            ));
        }

        return $this->structureModelFactory;
    }
450625
public function proto()
    {
        $objType = $this->objType();
        if (!$objType) {
            throw new RuntimeException('Can not create prototype, object type is undefined');
        }

        return $this->modelFactory()->get($objType);
    }
449507
protected function getViewHelperFactory()
    {
        $factory = $this->getPrototype(
                $this->viewHelperFactoryClass,
                ['umi\templating\extension\helper\IHelperFactory']
            )
            ->createInstance();

        if ($factory instanceof IModelAware && $this->modelFactory) {
            $factory->setModelFactory($this->modelFactory);
        }

        return $factory;
    }
1261936
protected function modelLoaderBuilder()
    {
        if (!isset($this->modelLoaderBuilder)) {
            throw new RuntimeException(sprintf(
                'Model Factory is not defined for [%s]',
                get_class($this)
            ));
        }

        return $this->modelLoaderBuilder;
    }
73929
protected function sourceFactory()
    {
        if (!isset($this->sourceFactory)) {
            throw new RuntimeException(
                sprintf('Source factory is not set for "%s"', get_class($this))
            );
        }
        return $this->sourceFactory;
    }
1262601
public function getModel()
    {
        if ($this->_model === null) {
            $this->_model = Yii::createObject($this->modelClass);

            if (!$this->_model instanceof NgRestModelInterface) {
                throw new InvalidConfigException("The modelClass '$this->modelClass' must be an instance of NgRestModelInterface.");
            }
        }
    
        return $this->_model;
    }
912784
public function getModel()
    {
        if (!is_object($this->_model)) {
            $this->_model = Yii::createObject(['class' => $this->_model]);
        }
        
        return $this->_model;
    }
140409
public function proto()
    {
        if (!$this->proto) {
            $this->proto = $this->modelFactory()->get($this->objType());
        }

        return $this->proto;
    }