ParseRelationOperation

Implements \Parse\Internal\FieldOperation

Class ParseRelationOperation - A class that is used to manage ParseRelation changes such as object add or remove.

author

Mohamed Madbouli mohamedmadbouli@fb.com

package

Parse\Internal

Methods

ParseRelationOperation constructor.

__construct(array<mixed,\Parse\ParseObject> $objectsToAdd, array<mixed,\Parse\ParseObject> $objectsToRemove) 
Throws
\Exception

Arguments

$objectsToAdd

array<mixed,\Parse\ParseObject>

ParseObjects to add

$objectsToRemove

array<mixed,\Parse\ParseObject>

ParseObjects to remove

Applies the current operation and returns the result.

_apply(mixed $oldValue, mixed $object, string $key) : mixed
Throws
\Exception

Arguments

$oldValue

mixed

Value prior to this operation.

$object

mixed

Value for this operation.

$key

string

Key to perform this operation on.

Response

mixed

Result of the operation.

Returns an associative array encoding of the current operation.

_encode() : mixed
Throws
\Exception

Response

mixed

Gets the className of the target objects.

_getTargetClass() : null|string

Response

null|string

Merge this operation with a previous operation and return the new operation.

_mergeWithPrevious(\Parse\Internal\FieldOperation $previous) : \Parse\Internal\FieldOperation
Throws
\Exception

Arguments

$previous

\Parse\Internal\FieldOperation

Previous operation.

Response

\Parse\Internal\FieldOperation

Merged operation result.

Adds an object or array of objects to the array, replacing any existing instance of the same object.

addObjects(array $objects, array &$container) 

Arguments

$objects

array

Array of ParseObjects to add.

$container

array

Array to contain new ParseObjects.

Helper function to check that all passed ParseObjects have same class name and assign targetClassName variable.

checkAndAssignClassName(array $objects) 
Throws
\Exception

Arguments

$objects

array

ParseObject array.

Convert any array to one dimensional array.

convertToOneDimensionalArray(array $array) : array
static

Arguments

$array

array

Response

array

Remove element or array of elements from one dimensional array.

removeElementsFromArray(mixed $elements, array &$array) 
static

Arguments

$elements

mixed

$array

array

Removes an object (and any duplicate instances of that object) from the array.

removeObjects(array $objects, array &$container) 

Arguments

$objects

array

Array of ParseObjects to remove.

$container

array

Array to remove from it ParseObjects.

Properties

The className of the target objects.

targetClassName : string
var

Type(s)

string

Array of objects to add to this relation.

relationsToAdd : array
var

Type(s)

array

Array of objects to remove from this relation.

relationsToRemove : array
var

Type(s)

array