CheckOwnerArgumentsTrait uses trait:short
Provides utilities for validating "owner" arguments against specific Documents model references.
This is mainly used to ensure that arguments passed to get()
, list()
, count()
or exist()
methods
actually correspond to existing document records.
Table of Contents
Properties
- $owner : array<string|int, mixed>|null
- The collection of all owner's arguments to check in the get|list|count|exist methods.
Methods
- assertExistInModel() : void
- Assert the existence of a specific property value in a Document model.
- checkOwnerArguments() : void
- Check all the 'owner' arguments with a specific Documents model reference.
- getDocumentsModel() : DocumentsModel|null
- Returns a Documents Model instance directly or with the DI container.
- initializeOwner() : static
- Initialize the owner definition.
Properties
$owner
The collection of all owner's arguments to check in the get|list|count|exist methods.
public
array<string|int, mixed>|null
$owner
= null
Methods
assertExistInModel()
Assert the existence of a specific property value in a Document model.
public
assertExistInModel(object|string|int|null $document, ExistModel $model[, string $name = Char::EMPTY ][, string|null $key = 'id' ]) : void
Parameters
- $document : object|string|int|null
-
The document to validate.
- $model : ExistModel
-
The OpenEdge model reference.
- $name : string = Char::EMPTY
-
The optional name of the resource to validate (use it in the error message).
- $key : string|null = 'id'
Tags
checkOwnerArguments()
Check all the 'owner' arguments with a specific Documents model reference.
public
checkOwnerArguments([array<string|int, mixed> $args = [] ]) : void
Parameters
- $args : array<string|int, mixed> = []
Tags
getDocumentsModel()
Returns a Documents Model instance directly or with the DI container.
public
getDocumentsModel(DocumentsModel|string|null $documents) : DocumentsModel|null
Parameters
- $documents : DocumentsModel|string|null
Tags
Return values
DocumentsModel|nullinitializeOwner()
Initialize the owner definition.
public
initializeOwner([array<string|int, mixed> $init = [] ]) : static
Parameters
- $init : array<string|int, mixed> = []