/var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/Datasource
NameSizeModeActions
Exception/-0755rm
Locator/-0755rm
composer.json12680644editdlrm
ConnectionInterface.php51060644editdlrm
ConnectionManager.php73580644editdlrm
ConnectionRegistry.php33750644editdlrm
EntityInterface.php84420644editdlrm
EntityTrait.php345930644editdlrm
FactoryLocator.php29110644editdlrm
FixtureInterface.php23750644editdlrm
InvalidPropertyInterface.php20740644editdlrm
LICENSE.txt12040644editdlrm
ModelAwareTrait.php58340644editdlrm
Paginator.php226280644editdlrm
PaginatorInterface.php13970644editdlrm
QueryCacher.php38320644editdlrm
QueryInterface.php148780644editdlrm
QueryTrait.php170340644editdlrm
README.md34140644editdlrm
RepositoryInterface.php91670644editdlrm
ResultSetDecorator.php13730644editdlrm
ResultSetInterface.php8840644editdlrm
RuleInvoker.php37720644editdlrm
RulesAwareTrait.php40920644editdlrm
RulesChecker.php114300644editdlrm
SchemaInterface.php48580644editdlrm
SimplePaginator.php13740644editdlrm
Edit: /var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/Datasource/ModelAwareTrait.php (5834B)
modelClass === null) { $this->modelClass = $name; } } /** * Loads and constructs repository objects required by this object * * Typically used to load ORM Table objects as required. Can * also be used to load other types of repository objects your application uses. * * If a repository provider does not return an object a MissingModelException will * be thrown. * * @param string|null $modelClass Name of model class to load. Defaults to $this->modelClass. * The name can be an alias like `'Post'` or FQCN like `App\Model\Table\PostsTable::class`. * @param string|null $modelType The type of repository to load. Defaults to the getModelType() value. * @return \Cake\Datasource\RepositoryInterface The model instance created. * @throws \Cake\Datasource\Exception\MissingModelException If the model class cannot be found. * @throws \UnexpectedValueException If $modelClass argument is not provided * and ModelAwareTrait::$modelClass property value is empty. */ public function loadModel(?string $modelClass = null, ?string $modelType = null): RepositoryInterface { $modelClass = $modelClass ?? $this->modelClass; if (empty($modelClass)) { throw new UnexpectedValueException('Default modelClass is empty'); } $modelType = $modelType ?? $this->getModelType(); $options = []; if (strpos($modelClass, '\\') === false) { [, $alias] = pluginSplit($modelClass, true); } else { $options['className'] = $modelClass; /** @psalm-suppress PossiblyFalseOperand */ $alias = substr( $modelClass, strrpos($modelClass, '\\') + 1, -strlen($modelType) ); $modelClass = $alias; } if (isset($this->{$alias})) { return $this->{$alias}; } $factory = $this->_modelFactories[$modelType] ?? FactoryLocator::get($modelType); if ($factory instanceof LocatorInterface) { $this->{$alias} = $factory->get($modelClass, $options); } else { $this->{$alias} = $factory($modelClass, $options); } if (!$this->{$alias}) { throw new MissingModelException([$modelClass, $modelType]); } return $this->{$alias}; } /** * Override a existing callable to generate repositories of a given type. * * @param string $type The name of the repository type the factory function is for. * @param callable|\Cake\Datasource\Locator\LocatorInterface $factory The factory function used to create instances. * @return void */ public function modelFactory(string $type, $factory): void { if (!$factory instanceof LocatorInterface && !is_callable($factory)) { throw new InvalidArgumentException(sprintf( '`$factory` must be an instance of Cake\Datasource\Locator\LocatorInterface or a callable.' . ' Got type `%s` instead.', getTypeName($factory) )); } $this->_modelFactories[$type] = $factory; } /** * Get the model type to be used by this class * * @return string */ public function getModelType(): string { return $this->_modelType; } /** * Set the model type to be used by this class * * @param string $modelType The model type * @return $this */ public function setModelType(string $modelType) { $this->_modelType = $modelType; return $this; } }