Parse PHP SDK API Reference

ParseRelation
in package
implements Encodable

Class ParseRelation - A class that is used to access all of the children of a many-to-many relationship.

Each instance of ParseRelation is associated with a particular parent object and key.

Tags
author

Mohamed Madbouli [email protected]

Interfaces, Classes and Traits

Encodable
Class Encodable - Interface for Parse Classes which provide an encode method.

Table of Contents

$key  : string
The key of the relation in the parent object.
$parent  : ParseObject
The parent of this relation.
$targetClassName  : string
The className of the target objects.
__construct()  : mixed
Creates a new Relation for the given parent object, key and class name of target objects.
_encode()  : array<string|int, mixed>
Return an encoded array of this relation.
add()  : mixed
Adds a ParseObject or an array of ParseObjects to the relation.
getQuery()  : ParseQuery
Gets a query that can be used to query the objects in this relation.
getTargetClass()  : string
Returns the target classname for the relation.
remove()  : mixed
Removes a ParseObject or an array of ParseObjects from this relation.
setParent()  : mixed
Set the parent object for the relation.
setTargetClass()  : mixed
Set the target classname for the relation.

Properties

$key

The key of the relation in the parent object.

private string $key

$targetClassName

The className of the target objects.

private string $targetClassName

Methods

__construct()

Creates a new Relation for the given parent object, key and class name of target objects.

public __construct(ParseObject $parent, string $key[, string $targetClassName = null ]) : mixed
Parameters
$parent : ParseObject

The parent of this relation.

$key : string

The key of the relation in the parent object.

$targetClassName : string = null

The className of the target objects.

Return values
mixed

_encode()

Return an encoded array of this relation.

public _encode() : array<string|int, mixed>
Return values
array<string|int, mixed>

add()

Adds a ParseObject or an array of ParseObjects to the relation.

public add(mixed $objects) : mixed
Parameters
$objects : mixed

The item or items to add.

Return values
mixed

getQuery()

Gets a query that can be used to query the objects in this relation.

public getQuery() : ParseQuery
Return values
ParseQuery

That restricts the results to objects in this relations.

getTargetClass()

Returns the target classname for the relation.

public getTargetClass() : string
Return values
string

remove()

Removes a ParseObject or an array of ParseObjects from this relation.

public remove(mixed $objects) : mixed
Parameters
$objects : mixed

The item or items to remove.

Return values
mixed

setTargetClass()

Set the target classname for the relation.

public setTargetClass(string $className) : mixed
Parameters
$className : string
Return values
mixed

Search results