DatabaseRepositoryTrait
`fetch()`, `fresh()` and `freshen()` for repositories answered from the local MTGJSON build instead of an HTTP endpoint. MTGJSON serves cards and sets only inside whole files, so there is no per-item route to call.
Tags
Table of Contents
Properties
Methods
- fetch() : PromiseInterface<string|int, Part>
- Gets a part from the repository or the MTGJSON build.
- fresh() : PromiseInterface<string|int, Part>
- Refills a part from the MTGJSON build.
- freshen() : PromiseInterface
- Rejects: the repository is too large to load whole; search it instead.
- lookup() : Part|null
- Looks one part up in the open build.
Properties
$database
public
Database
$database
The local MTGJSON build.
Methods
fetch()
Gets a part from the repository or the MTGJSON build.
public
fetch(string $id[, bool $fresh = false ]) : PromiseInterface<string|int, Part>
Parameters
- $id : string
-
The discriminator value to search for.
- $fresh : bool = false
-
Whether to skip the cache.
Return values
PromiseInterface<string|int, Part> —Rejects with \OutOfBoundsException when the build has no such item.
fresh()
Refills a part from the MTGJSON build.
public
fresh(Part $part[, array<string|int, mixed> $queryparams = [] ]) : PromiseInterface<string|int, Part>
Parameters
- $part : Part
-
The part to refresh.
- $queryparams : array<string|int, mixed> = []
-
Unused; kept for the upstream signature.
Return values
PromiseInterface<string|int, Part>freshen()
Rejects: the repository is too large to load whole; search it instead.
public
freshen([array<string|int, mixed> $queryparams = [] ]) : PromiseInterface
Parameters
- $queryparams : array<string|int, mixed> = []
-
Unused.
Return values
PromiseInterface —Rejects with \BadMethodCallException.
lookup()
Looks one part up in the open build.
protected
abstract lookup(string $id) : Part|null
Parameters
- $id : string
-
The discriminator value.
Return values
Part|null —Null when the build has no such item.