@param string $modelClass

@throws \RuntimeException
324786
public function addResource($modelClass)
    {
        $code = '';

        if (is_file($this->file)) {
            $code = rtrim(file_get_contents($this->file));
        }

        $parts = explode('\\', $modelClass);

        $this->renderFile('Blast.yml.twig', $this->file, array(
            'fqcn'    => $modelClass,
            'fields'  => $this->modelManager->getExportFields($modelClass),
            'entity'  => array_pop($parts),
            'oldCode' => $code,
        ));
    }
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;
    }
21282
protected function makeModelDisplayValueFromModelClass($modelClass)
    {
        $stripPrefix = config('cms-models.collector.models-namespace');

        if ($stripPrefix && starts_with($modelClass, $stripPrefix)) {
            $modelClass = trim(substr($modelClass, 0, strlen($stripPrefix)), '\\');
        }

        return ucfirst(str_replace('\\', ' ', $modelClass));
    }
733092
public function instanceApp(string $applicationClass): ApplicationInterface
    {
        if (!$this->applicationConfig->isApplicationClassValid($applicationClass)) {
            throw new \RuntimeException('Invalid application class: ' . $applicationClass);
        }
        try {
            $arguments = $this->applicationConfig->getApplicationArguments(
                $this->applicationConfig->getApplicationIdByClass($applicationClass)
            );
        } catch (\RuntimeException $e) {
            $arguments = [];
        }

        $appId = $this->applicationConfig->getApplicationIdByClass($applicationClass);

        return $this->instanceAppWith(
            $applicationClass,
            $arguments,
            ['appId' => $appId]
        );
    }
1138309
public function defineModelClasses($modelClasses = [])
    {
        $this->modelMap = ArrayHelper::merge(
            $this->getDefaultModels(),
            $this->modelMap,
            $modelClasses
        );
    }
247464
protected function findModel($modelClass, $attributes = [])
    {
        $query = $this->buildQuery($modelClass, $attributes);

        return $query->first();
    }
490569
protected function validateModelClass($modelClass)
    {
        // Validate the expected model exists.
        if (!class_exists($modelClass)) {
            throw new CrudModelException('The related model does not exist.');
        }

        // Validate the model extends the correct base model.
        if (!is_subclass_of($modelClass, self::MICROSERVICE_BASE_MODEL_CLASS)) {
            throw new CrudModelException('The related model must extend the MicroServiceBaseModel abstract class.');
        }

        // Validate the model implements the correct interface.
        if (!in_array(self::MICROSERVICE_CRUD_MODEL_INTERFACE, class_implements($modelClass))) {
            throw new CrudModelException('The related model must implement CrudModelInterface.');
        }
    }
238025
public function setCurrentRecord(Mage_Core_Model_Abstract $model = null)
    {
        if ($model) {
            $expectedClass = get_class($this->getModel());
            if (!is_a($model, $expectedClass)) {
                throw new RuntimeException($this->__('Invalid model class. Expected:%1$s Passed:%2$s', $expectedClass, get_class($model)));
            }
        }

        Mage::unregister($this->getCurrentRecordKey());

        if ($model) {
            Mage::register($this->getCurrentRecordKey(), $model);
        }

        return $this;
    }
324865
public function addClass($class) {
        $this->setVariable(self::VIEW_MODEL_CLASS, $this->addValue($this->getVariable(self::VIEW_MODEL_CLASS), $class));
    }
396000
public function getDataMapperForEntity($entityClass)
    {
        Assertion::keyIsset($this->entityDataMapperMap, $entityClass, sprintf(
            "Could not find data mapper service name for entity class '%s'",
            $entityClass
        ));

        $entityDMServiceName = $this->entityDataMapperMap[$entityClass];

        $dataMapper = $this->get($entityDMServiceName);

        if (! is_a($dataMapper->getEntityClass(), $entityClass, true)) {
            throw new Exception\RuntimeException(sprintf(
                '"%s" entity class mismatch: expected "%s", got "%s"',
                $entityDMServiceName,
                $entityClass,
                $dataMapper->getEntityClass()
            ));
        }

        return $dataMapper;
    }
141789
protected function determineTargetModelFromSource($modelClass, $source)
    {
        if ( ! is_a($modelClass, Model::class, true)) {
            // @codeCoverageIgnoreStart
            throw new UnexpectedValueException("{$modelClass} is not an Eloquent model");
            // @codeCoverageIgnoreEnd
        }

        $model = new $modelClass;

        if ( ! ($relation = $this->getNestedRelation($model, $source))) {
            // @codeCoverageIgnoreStart
            $relation = $this->resolveModelSource($model, $source);
            // @codeCoverageIgnoreEnd
        }

        if ( ! ($relation instanceof Relation)) {
            // @codeCoverageIgnoreStart
            throw new UnexpectedValueException(
                "Source {$source} on {$modelClass} does not resolve to an Eloquent relation instance"
            );
            // @codeCoverageIgnoreEnd
        }

        /** @var Relation $relation */
        return $relation->getRelated();
    }
7717
public function addModelTransformer($modelTransformer, $priority = 0)
    {
        if (!(($modelTransformer instanceof ModelTransformerInterface)
            || ($modelTransformer instanceof ContextualModelTransformerInterface)
            || ($modelTransformer instanceof ObjectTransformerInterface)
        )
        ) {
            throw new \RuntimeException(
                sprintf('Model transformer should be an instance of "%s", "%s" or "%s"', ModelTransformerInterface::class, ContextualModelTransformerInterface::class, ObjectTransformerInterface::class)
            );
        }

        if ($modelTransformer instanceof ObjectTransformerInterface) {
            if (!isset($this->objectTransformers[$modelTransformer->getSupportedClass()])) {
                $this->objectTransformers[$modelTransformer->getSupportedClass()] = [];
            }

            if (!isset($this->objectTransformers[$modelTransformer->getSupportedClass()][$modelTransformer->getTargetClass()])) {
                $this->objectTransformers[$modelTransformer->getSupportedClass()][$modelTransformer->getTargetClass()] = [];
            }

            $this->objectTransformers[$modelTransformer->getSupportedClass()][$modelTransformer->getTargetClass()][$priority] = $modelTransformer;
            unset($this->sortedObjectTransformers);

            return $this;
        }

        if (!isset($this->modelTransformers[$priority])) {
            $this->modelTransformers[$priority] = [];
        }

        $this->modelTransformers[$priority][] = $modelTransformer;
        unset($this->sortedModelTransformers);

        return $this;
    }
383104
public function IncludeMap($objectclass)
	{
		try
		{
			Includer::RequireClass($objectclass,"Model/DAO/");
		}
		catch (IncludeException $ex)
		{
			throw new Exception($ex->getMessage() . '.  If a map file does not exist then ' . get_class($this) . ' can implement GetFieldFromProp instead.');
		}
	}
600982
public function execute()
    {
        foreach (array_unique($this->bootstrappers->all()) as $class) {
            $bootstrapper = $this->create($class);

            if (!method_exists($bootstrapper, 'run')) {
                throw new \RuntimeException("$class must have run() method");
            }

            $bootstrapper->run();
        }
    }
190598
protected function setFormClass($formClass){

        if (is_string($formClass)){
            $formClass = explode(" " , $formClass);
        }

        $this->formClass = $formClass;
    }
1123253
public function setEntityClass($entityClass)
    {
        if (!is_string($entityClass)) {
            throw new \InvalidArgumentException('The attribute entityClass on the class Project has to be string (' . gettype($entityClass) . ('object' === gettype($entityClass) ? ' ' . get_class($entityClass) : '') . ' given).');
        }

        $this->entityClass = $entityClass;

        return $this;
    }
1159727
public static function observe($class)
    {
        $className = is_string($class) ? $class : get_class($class);

        // When registering a model observer, we will spin through the possible events
        // and determine if this observer has that method. If it does, we will hook
        // it into the model's event system, making it convenient to watch these.
        foreach (static::$observables as $event) {
            if (method_exists($class, $event)) {
                static::registerModelEvent($event, $className . '@' . $event);
            }
        }
    }