ReplaceModel
Contract for models able to replace an existing document.
A ReplaceModel exposes a single ReplaceModel::replace() operation that
overwrites a stored document with a brand new payload. Unlike
UpdateModel::update(), which merges a partial patch, replace() swaps
the whole document — any field absent from the new payload is dropped.
Tags
Table of Contents
Methods
- replace() : mixed
- Replaces an existing document in the model.
Methods
replace()
Replaces an existing document in the model.
public
replace([array<string|int, mixed> $init = [] ]) : mixed
Parameters
- $init : array<string|int, mixed> = []
-
Operation options carrying the replacement, typically the target
key/id, the fulldocumentpayload, optionalbindsand a return clause.
Tags
Return values
mixed —The replaced document (or its result), depending on the implementation.