Parse PHP SDK API Reference

ParseRelationOperation
in package
implements FieldOperation

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

Tags
author

Mohamed Madbouli [email protected]

Interfaces, Classes and Traits

FieldOperation
Class FieldOperation - Interface for all Parse Field Operations.

Table of Contents

$relationsToAdd  : array<string|int, mixed>
Array of objects to add to this relation.
$relationsToRemove  : array<string|int, mixed>
Array of objects to remove from this relation.
$targetClassName  : string
The className of the target objects.
__construct()  : mixed
ParseRelationOperation constructor.
_apply()  : mixed
Applies the current operation and returns the result.
_encode()  : mixed
Returns an associative array encoding of the current operation.
_getTargetClass()  : null|string
Gets the className of the target objects.
_mergeWithPrevious()  : FieldOperation
Merge this operation with a previous operation and return the new operation.
convertToOneDimensionalArray()  : array<string|int, mixed>
Convert any array to one dimensional array.
removeElementsFromArray()  : mixed
Remove element or array of elements from one dimensional array.
addObjects()  : mixed
Adds an object or array of objects to the array, replacing any existing instance of the same object.
checkAndAssignClassName()  : mixed
Helper function to check that all passed ParseObjects have same class name and assign targetClassName variable.
removeObjects()  : mixed
Removes an object (and any duplicate instances of that object) from the array.

Properties

$relationsToAdd

Array of objects to add to this relation.

private array<string|int, mixed> $relationsToAdd = []

$relationsToRemove

Array of objects to remove from this relation.

private array<string|int, mixed> $relationsToRemove = []

Methods

_apply()

Applies the current operation and returns the result.

public _apply(mixed $oldValue, mixed $object, string $key) : mixed
Parameters
$oldValue : mixed

Value prior to this operation.

$object : mixed

Value for this operation.

$key : string

Key to perform this operation on.

Tags
throws
Exception
Return values
mixed

Result of the operation.

_encode()

Returns an associative array encoding of the current operation.

public _encode() : mixed
Tags
throws
Exception
Return values
mixed

_getTargetClass()

Gets the className of the target objects.

public _getTargetClass() : null|string
Return values
null|string

convertToOneDimensionalArray()

Convert any array to one dimensional array.

public static convertToOneDimensionalArray(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>
Return values
array<string|int, mixed>

removeElementsFromArray()

Remove element or array of elements from one dimensional array.

public static removeElementsFromArray(mixed $elements, array<string|int, mixed> &$array) : mixed
Parameters
$elements : mixed
$array : array<string|int, mixed>
Return values
mixed

addObjects()

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

private addObjects(array<string|int, mixed> $objects, array<string|int, mixed> &$container) : mixed
Parameters
$objects : array<string|int, mixed>

Array of ParseObjects to add.

$container : array<string|int, mixed>

Array to contain new ParseObjects.

Return values
mixed

checkAndAssignClassName()

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

private checkAndAssignClassName(array<string|int, mixed> $objects) : mixed
Parameters
$objects : array<string|int, mixed>

ParseObject array.

Tags
throws
Exception
Return values
mixed

removeObjects()

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

private removeObjects(array<string|int, mixed> $objects, array<string|int, mixed> &$container) : mixed
Parameters
$objects : array<string|int, mixed>

Array of ParseObjects to remove.

$container : array<string|int, mixed>

Array to remove from it ParseObjects.

Return values
mixed

Search results