loadModel()
loadModel(string|null $modelClass = null, string|null $modelType = null) : \Cake\Datasource\RepositoryInterface
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.
Parameters
string|null |
$modelClass |
Name of model class to load. Defaults to $this->modelClass |
string|null |
$modelType |
The type of repository to load. Defaults to the modelType() value. |
Throws
- \Cake\Datasource\Exception\MissingModelException
If the model class cannot be found.
- \InvalidArgumentException
When using a type that has not been registered.
- \UnexpectedValueException
If no model type has been defined
Returns
\Cake\Datasource\RepositoryInterface
— The model instance created.