AlterGetDocumentPropertyTrait
Provides logic to retrieve a document using a Documents model based on a given value and definition.
This trait depends on the DocumentsTrait to access the document model.
The main method alterGetDocument() is typically used as part of a data transformation or hydration process
where a scalar or identifier is replaced by a fully loaded document instance.
Usage example:
class MyMapper {
use AlterGetDocumentPropertyTrait;
}
$mapper = new MyMapper();
$doc = $mapper->alterGetDocument(42, ['UserModel', 'id'], $modified);
if ($modified) {
echo "Document was loaded successfully.";
}
Tags
Table of Contents
Methods
- alterGetDocument() : mixed
- Gets a document with a Documents model.
Methods
alterGetDocument()
Gets a document with a Documents model.
public
alterGetDocument(mixed $value[, array<string|int, mixed> $definition = [] ][, Container|null $container = null ][, bool &$modified = false ]) : mixed
Parameters
- $value : mixed
- $definition : array<string|int, mixed> = []
- $container : Container|null = null
-
DI container for resolving base URL from service definitions.
- $modified : bool = false