DocumentsControllerPutTrait uses trait:short
Table of Contents
Methods
- put() : mixed
- Replace a document in a collection with a specific identifier (by default use the _key attribute).
- update() : mixed
- Provides the functionality to update or replace documents in an ArangoDB collection using PATCH or PUT HTTP methods. This trait handles: - Document existence verification.
Methods
put()
Replace a document in a collection with a specific identifier (by default use the _key attribute).
public
put([ServerRequestInterface|null $request = null ][, ResponseInterface|null $response = null ][, array<string|int, mixed> $args = [] ][, array<string|int, mixed> $init = [] ]) : mixed
Example: PUT ../collection/{id}
Parameters
- $request : ServerRequestInterface|null = null
- $response : ResponseInterface|null = null
- $args : array<string|int, mixed> = []
-
An associative array that contains values for the current route’s named placeholders.
- $init : array<string|int, mixed> = []
-
An optional associative array to initialize the method.
update()
Provides the functionality to update or replace documents in an ArangoDB collection using PATCH or PUT HTTP methods. This trait handles: - Document existence verification.
public
update([ServerRequestInterface|null $request = null ][, ResponseInterface|null $response = null ][, array<string|int, mixed> $args = [] ][, array<string|int, mixed> $init = [] ]) : mixed
- Preparation and filtering of document data.
- Validation against defined rules.
- Conditional update (PATCH) or replacement (PUT) of documents.
- Hooks for pre- and post-update actions (
beforeUpdateandafterUpdate).
Usage:
- PATCH ../collection/{id} -> Partial update
- PUT ../collection/{id} -> Full replacement
Parameters
- $request : ServerRequestInterface|null = null
-
Optional PSR-7 ServerRequest instance.
- $response : ResponseInterface|null = null
-
Optional PSR-7 Response instance.
- $args : array<string|int, mixed> = []
-
Route parameters (e.g., ['id' => '_key']).
- $init : array<string|int, mixed> = []
-
Initialization options and additional context.
Return values
mixed —The updated document data on success, or a standardized error response on failure.