AddUniqueOperation
in package
implements
FieldOperation
Class AddUniqueOperation - Operation to add unique objects to an array key.
Tags
Interfaces, Classes and Traits
- FieldOperation
- Class FieldOperation - Interface for all Parse Field Operations.
Table of Contents
- $objects : array<string|int, mixed>
- Array containing objects to add.
- __construct() : mixed
- Creates an operation for adding unique values to an array key.
- _apply() : array<string|int, mixed>
- Apply the current operation and return the result.
- _encode() : array<string|int, mixed>
- Returns an associative array encoding of this operation.
- _mergeWithPrevious() : FieldOperation
- Merge this operation with the previous operation and return the result.
- getValue() : mixed
- Returns the values for this operation.
- isParseObjectInArray() : bool
- Checks if a parse object is contained in a given array of values
Properties
$objects
Array containing objects to add.
private
array<string|int, mixed>
$objects
Methods
__construct()
Creates an operation for adding unique values to an array key.
public
__construct(array<string|int, mixed> $objects) : mixed
Parameters
- $objects : array<string|int, mixed>
-
Objects to add.
Tags
Return values
mixed —_apply()
Apply the current operation and return the result.
public
_apply(mixed $oldValue, array<string|int, mixed> $obj, string $key) : array<string|int, mixed>
Parameters
- $oldValue : mixed
-
Value prior to this operation.
- $obj : array<string|int, mixed>
-
Value being applied.
- $key : string
-
Key this operation affects.
Return values
array<string|int, mixed> —_encode()
Returns an associative array encoding of this operation.
public
_encode() : array<string|int, mixed>
Return values
array<string|int, mixed> —_mergeWithPrevious()
Merge this operation with the previous operation and return the result.
public
_mergeWithPrevious(FieldOperation $previous) : FieldOperation
Parameters
- $previous : FieldOperation
-
Previous Operation.
Tags
Return values
FieldOperation —Merged Operation.
getValue()
Returns the values for this operation.
public
getValue() : mixed
Return values
mixed —isParseObjectInArray()
Checks if a parse object is contained in a given array of values
private
isParseObjectInArray(ParseObject $parseObject, array<string|int, mixed> $oldValue) : bool
Parameters
- $parseObject : ParseObject
-
ParseObject to check for existence of
- $oldValue : array<string|int, mixed>
-
Array to check if ParseObject is present in