GetModel extends ExistModel
Contract for models able to retrieve a single document.
A GetModel extends ExistModel, so an implementation can both test for
a document and fetch it. The GetModel::get() operation returns the
resolved document (or value) identified by the supplied options.
Tags
Table of Contents
Methods
- exist() : bool
- Indicates whether a document matching the given options exists.
- get() : mixed
- Returns a single document matching the given options.
Methods
exist()
Indicates whether a document matching the given options exists.
public
exist([array<string|int, mixed> $init = [] ]) : bool
Parameters
- $init : array<string|int, mixed> = []
-
Operation options identifying the document to test, typically a
key/idvalue, a set ofconditionsand theirbinds.
Tags
Return values
bool —true if at least one matching document exists, otherwise false.
get()
Returns a single document matching the given options.
public
get([array<string|int, mixed> $init = [] ]) : mixed
Parameters
- $init : array<string|int, mixed> = []
-
Operation options identifying the document to fetch, typically a
key/idvalue, optionalconditionswith theirbindsand projection settings.
Tags
Return values
mixed —The resolved document (commonly an array or object), or a null/empty value when nothing matches, depending on the implementation.