$objType
$objType : string
The object type.
The base model (FQCN) to load objects of.
Load a single model from its source, of from cache.
Use the magic methods to load automatically from call and get; this allows for easy integration in templating engines like Mustache.
This object is immutable.
__call(string|integer $ident, mixed $args = null) : \Charcoal\Model\ModelInterface
Retrieve an object by its key.
string|integer | $ident | The object identifier to load. |
mixed | $args | Unused; Method arguments. |
__get(string|integer $ident) : \Charcoal\Model\ModelInterface
Retrieve an object by its key.
string|integer | $ident | The object identifier to load. |
offsetGet(string|integer $ident) : \Charcoal\Model\ModelInterface
Retrieve an object by its key.
string|integer | $ident | The object identifier to load. |
load(string|integer $ident, boolean $useCache = true, boolean $reloadObj = false) : \Charcoal\Model\ModelInterface
Retrieve an object, by its key, from its source or from the cache.
When the cache is enabled, only the object's data is stored. This prevents issues when unserializing a class that might have dependencies.
string|integer | $ident | The object identifier to load. |
boolean | $useCache | If FALSE, ignore the cached object. Defaults to TRUE. |
boolean | $reloadObj | If TRUE, refresh the cached object. Defaults to FALSE. |
loadFromSource(string|integer $ident) : \Charcoal\Model\ModelInterface
Load an objet from its soure.
string|integer | $ident | The object identifier to load. |
setObjType(string $objType) : \Charcoal\Model\Service\ModelLoader
Set the object type.
string | $objType | The object type to load with this loader. |
If the object type is not a string.
Chainable
setObjKey(string $objKey) : \Charcoal\Model\Service\ModelLoader
Set the object key.
string | $objKey | The object key to use for laoding. |
If the object key is not a string.
Chainable
setFactory(\Charcoal\Factory\FactoryInterface $factory) : \Charcoal\Model\Service\ModelLoader
Set the model factory.
\Charcoal\Factory\FactoryInterface | $factory | The factory to create models. |
Chainable
setCachePool(\Psr\Cache\CacheItemPoolInterface $cachePool) : \Charcoal\Model\Service\ModelLoader
Set the cache pool handler.
\Psr\Cache\CacheItemPoolInterface | $cachePool | A PSR-6 compatible cache pool. |
Chainable