ParseRole
extends ParseObject
in package
Class ParseRole - Representation of an access Role.
Tags
Table of Contents
- $parseClassName : string
- Parse Class name
- $operationSet : array<string|int, mixed>
- Set of unsaved operations.
- $serverData : array<string|int, mixed>
- Data as it exists on the server.
- $className : string
- Class name for data on Parse.
- $createdAt : DateTime
- Timestamp when object was created.
- $dataAvailability : array<string|int, mixed>
- Determine if data available for a given key or not.
- $estimatedData : array<string|int, mixed>
- Estimated value of applying operationSet to serverData.
- $hasBeenFetched : bool
- Whether the object has been fully fetched from Parse.
- $objectId : string
- Unique identifier on Parse.
- $registeredSubclasses : array<string|int, mixed>
- Holds the registered subclasses and Parse class names.
- $updatedAt : DateTime
- Timestamp when object was last updated.
- __construct() : mixed
- Create a Parse Object.
- __get() : mixed
- Getter to catch direct property calls and pass them to the get function.
- __isset() : bool
- Magic handler to catch isset calls to object properties.
- __set() : mixed
- Setter to catch property calls and protect certain fields.
- _encode() : string
- Return a JSON encoded value of the object.
- _mergeAfterFetch() : mixed
- Merges data received from the server.
- _mergeAfterFetchWithSelectedKeys() : mixed
- Merges data received from the server with a given selected keys.
- _mergeMagicFields() : mixed
- Handle merging of special fields for the object.
- _performOperation() : mixed
- Perform an operation on an object property.
- _toPointer() : array<string|int, mixed>
- Gets a Pointer referencing this Object.
- _unregisterSubclass() : mixed
- Un-register a subclass.
- add() : mixed
- Add a value to an array property.
- addUnique() : mixed
- Add unique values to an array property.
- beforeSave() : void
- Before save stub
- clear() : mixed
- Clear all keys on this object by creating delete operations for each key.
- create() : ParseObject
- Static method which returns a new Parse Object for a given class Optionally creates a pointer object if the objectId is provided.
- createRole() : ParseRole
- Create a ParseRole object with a given name and ACL.
- decode() : ParseObject
- Decodes and returns a ParseObject from an encoded object
- delete() : mixed
- Delete a key from an object.
- destroy() : mixed
- Delete the object from Parse.
- destroyAll() : mixed
- Delete an array of objects.
- encode() : string
- Returns a JSON encoded array of a ParseObject
- exists() : bool
- Returns true if this object exists on the Server
- fetch() : ParseObject
- Fetch the whole object from the server and update the local object.
- fetchAll() : array<string|int, mixed>
- Fetch an array of Parse objects from the server.
- fetchAllWithInclude() : array<string|int, mixed>
- Fetch an array of Parse Objects from the server with nested Parse Objects.
- fetchWithInclude() : ParseObject
- Fetch an array of Parse objects from the server.
- get() : mixed
- Get current value for an object property.
- getACL() : ParseACL
- Get the ACL assigned to the object.
- getAllKeys() : array<string|int, mixed>
- Get values for all keys of an object.
- getClassName() : string
- Get the Parse Class Name for the object.
- getCreatedAt() : DateTime|null
- Get the createdAt for the object, or null if unsaved.
- getName() : string
- Returns the role name.
- getObjectId() : string|null
- Get the objectId for the object, or null if unsaved.
- getRegisteredSubclass() : ParseObject
- Get the registered subclass for a Parse class, or a generic ParseObject if no subclass is registered.
- getRelation() : ParseRelation
- Access or create a Relation value for a key.
- getRoles() : ParseRelation
- Gets the ParseRelation for the ParseRoles which are direct children of this role. These roles' users are granted any privileges that this role has been granted.
- getUpdatedAt() : DateTime|null
- Get the updatedAt for the object, or null if unsaved.
- getUsers() : ParseRelation
- Gets the ParseRelation for the ParseUsers which are direct children of this role. These users are granted any privileges that this role has been granted.
- has() : bool
- Check if the object has a given key.
- hasRegisteredSubclass() : bool
- Check whether there is a subclass registered for a given parse class.
- increment() : mixed
- Increment a numeric key by a certain value.
- isDataAvailable() : bool
- Returns true if the object has been fetched.
- isDirty() : bool
- Check if the object or any of its child objects have unsaved operations.
- isKeyDirty() : bool
- Check if the a value associated with a key has been added/updated/removed and not saved yet.
- query() : ParseQuery
- Creates a ParseQuery for the subclass of ParseObject.
- registerSubclass() : mixed
- Register a subclass. Should be called before any other Parse functions.
- remove() : mixed
- Remove a value from an array for an object key.
- revert() : mixed
- Revert all unsaved operations.
- save() : mixed
- Handles pre-saving of this role Calls ParseObject::save to finish
- saveAll() : mixed
- Save all the objects in the provided array.
- set() : mixed
- Validate and set a value for an object key.
- setACL() : mixed
- Set ACL for this object.
- setArray() : mixed
- Set an array value for an object key.
- setAssociativeArray() : mixed
- Set an associative array value for an object key.
- setName() : mixed
- Sets the role name.
- _isDirty() : bool
- Detects if the object (and optionally the child objects) has unsaved changes.
- rebuildEstimatedData() : mixed
- Start from serverData and process operations to generate the current value set for an object.
- _isDataAvailable() : bool
- Returns whether or not data is available for a given key
- applyOperations() : mixed
- Apply operations to a target object.
- canBeSerialized() : bool
- Determine if the current object can be serialized for saving.
- canBeSerializedAsValue() : bool
- Checks the given object and any children to see if the whole object can be serialized for saving.
- deepSave() : mixed
- Save object and unsaved children within.
- destroyBatch() : array<string|int, mixed>
- Destroy batch of objects.
- findUnsavedChildren() : mixed
- Find unsaved children inside an object.
- getACLWithCopy() : ParseACL|null
- Internally retrieves the ACL assigned to this object, conditionally returning a copy of the existing one
- getSaveJSON() : array<string|int, mixed>
- Returns JSON object of the unsaved operations.
- getSubclass() : mixed
- Gets the Subclass className if exists, otherwise false.
- hasDirtyChildren() : bool
- Determines whether this object has child objects that are dirty
- mergeAfterSave() : mixed
- Merge server data after a save completes.
- mergeFromObject() : mixed
- Merge data from other object.
- mergeFromServer() : mixed
- Merges data received from the server.
- toObjectIdArray() : array<string|int, mixed>
- Creates an array of object ids from a given array of ParseObjects
- traverse() : mixed
- Traverse object to find children.
- updateWithFetchedResults() : array<string|int, mixed>
- Merges an existing array of objects with their fetched counterparts
Properties
$parseClassName
Parse Class name
public
static string
$parseClassName
= '_Role'
$operationSet
Set of unsaved operations.
protected
array<string|int, mixed>
$operationSet
$serverData
Data as it exists on the server.
protected
array<string|int, mixed>
$serverData
$className
Class name for data on Parse.
private
string
$className
$createdAt
Timestamp when object was created.
private
DateTime
$createdAt
$dataAvailability
Determine if data available for a given key or not.
private
array<string|int, mixed>
$dataAvailability
$estimatedData
Estimated value of applying operationSet to serverData.
private
array<string|int, mixed>
$estimatedData
$hasBeenFetched
Whether the object has been fully fetched from Parse.
private
bool
$hasBeenFetched
$objectId
Unique identifier on Parse.
private
string
$objectId
$registeredSubclasses
Holds the registered subclasses and Parse class names.
private
static array<string|int, mixed>
$registeredSubclasses
= []
$updatedAt
Timestamp when object was last updated.
private
DateTime
$updatedAt
Methods
__construct()
Create a Parse Object.
public
__construct([string $className = null ][, mixed $objectId = null ][, bool $isPointer = false ]) : mixed
Creates a pointer object if an objectId is provided, otherwise creates a new object.
Parameters
- $className : string = null
-
Class Name for data on Parse.
- $objectId : mixed = null
-
Object Id for Existing object.
- $isPointer : bool = false
Tags
Return values
mixed —__get()
Getter to catch direct property calls and pass them to the get function.
public
__get(string $key) : mixed
Parameters
- $key : string
-
Key to retrieve from the Object.
Return values
mixed —__isset()
Magic handler to catch isset calls to object properties.
public
__isset(string $key) : bool
Parameters
- $key : string
-
Key to check on the object.
Return values
bool —__set()
Setter to catch property calls and protect certain fields.
public
__set(string $key, mixed $value) : mixed
Parameters
- $key : string
-
Key to set a value on.
- $value : mixed
-
Value to assign.
Tags
Return values
mixed —_encode()
Return a JSON encoded value of the object.
public
_encode() : string
Return values
string —_mergeAfterFetch()
Merges data received from the server.
public
_mergeAfterFetch(array<string|int, mixed> $result[, bool $completeData = true ]) : mixed
Parameters
- $result : array<string|int, mixed>
-
Data retrieved from the server.
- $completeData : bool = true
-
Fetch all data or not.
Return values
mixed —_mergeAfterFetchWithSelectedKeys()
Merges data received from the server with a given selected keys.
public
_mergeAfterFetchWithSelectedKeys(array<string|int, mixed> $result, array<string|int, mixed> $selectedKeys) : mixed
Parameters
- $result : array<string|int, mixed>
-
Data retrieved from the server.
- $selectedKeys : array<string|int, mixed>
-
Keys to be fetched. Null or empty means all data will be fetched.
Return values
mixed —_mergeMagicFields()
Handle merging of special fields for the object.
public
_mergeMagicFields(array<string|int, mixed> &$data) : mixed
Parameters
- $data : array<string|int, mixed>
-
Data received from server.
Return values
mixed —_performOperation()
Perform an operation on an object property.
public
_performOperation(string $key, FieldOperation $operation) : mixed
Parameters
- $key : string
-
Key to perform an operation upon.
- $operation : FieldOperation
-
Operation to perform.
Return values
mixed —_toPointer()
Gets a Pointer referencing this Object.
public
_toPointer() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —_unregisterSubclass()
Un-register a subclass.
public
static _unregisterSubclass() : mixed
Cannot be called on the base class ParseObject.
Return values
mixed —add()
Add a value to an array property.
public
add(string $key, mixed $value) : mixed
Parameters
- $key : string
-
Key for array value on object to add a value to.
- $value : mixed
-
Value to add.
Return values
mixed —addUnique()
Add unique values to an array property.
public
addUnique(string $key, mixed $value) : mixed
Parameters
- $key : string
-
Key for array value on object.
- $value : mixed
-
Value list to add uniquely.
Return values
mixed —beforeSave()
Before save stub
public
beforeSave() : void
Return values
void —clear()
Clear all keys on this object by creating delete operations for each key.
public
clear() : mixed
Return values
mixed —create()
Static method which returns a new Parse Object for a given class Optionally creates a pointer object if the objectId is provided.
public
static create(string $className[, string $objectId = null ][, bool $isPointer = false ]) : ParseObject
Parameters
- $className : string
-
Class Name for data on Parse.
- $objectId : string = null
-
Unique identifier for existing object.
- $isPointer : bool = false
-
If the object is a pointer.
Return values
ParseObject —createRole()
Create a ParseRole object with a given name and ACL.
public
static createRole(string $name, ParseACL $acl) : ParseRole
Parameters
- $name : string
- $acl : ParseACL
Return values
ParseRole —decode()
Decodes and returns a ParseObject from an encoded object
public
static decode(string|array<string|int, mixed> $encoded) : ParseObject
Parameters
- $encoded : string|array<string|int, mixed>
-
Encoded ParseObject to decode
Tags
Return values
ParseObject —delete()
Delete a key from an object.
public
delete(string $key) : mixed
Parameters
- $key : string
-
Key to remove from object.
Return values
mixed —destroy()
Delete the object from Parse.
public
destroy([bool $useMasterKey = false ]) : mixed
Parameters
- $useMasterKey : bool = false
-
Whether to use the master key.
Return values
mixed —destroyAll()
Delete an array of objects.
public
static destroyAll(array<string|int, mixed> $objects[, bool $useMasterKey = false ][, int $batchSize = 40 ]) : mixed
Parameters
- $objects : array<string|int, mixed>
-
Objects to destroy.
- $useMasterKey : bool = false
-
Whether to use the master key or not.
- $batchSize : int = 40
-
Number of objects to process per request
Tags
Return values
mixed —encode()
Returns a JSON encoded array of a ParseObject
public
encode() : string
Return values
string —exists()
Returns true if this object exists on the Server
public
exists([bool $useMasterKey = false ]) : bool
Parameters
- $useMasterKey : bool = false
-
Whether to use the Master Key.
Return values
bool —fetch()
Fetch the whole object from the server and update the local object.
public
fetch([bool $useMasterKey = false ]) : ParseObject
Parameters
- $useMasterKey : bool = false
-
Whether to use the master key and override ACLs
Return values
ParseObject —Returns self, so you can chain this call.
fetchAll()
Fetch an array of Parse objects from the server.
public
static fetchAll(array<string|int, mixed> $objects[, bool $useMasterKey = false ]) : array<string|int, mixed>
Parameters
- $objects : array<string|int, mixed>
-
The ParseObjects to fetch
- $useMasterKey : bool = false
-
Whether to override ACLs
Return values
array<string|int, mixed> —fetchAllWithInclude()
Fetch an array of Parse Objects from the server with nested Parse Objects.
public
static fetchAllWithInclude(array<string|int, mixed> $objects, mixed $includeKeys[, bool $useMasterKey = false ]) : array<string|int, mixed>
Parameters
- $objects : array<string|int, mixed>
-
The ParseObjects to fetch
- $includeKeys : mixed
-
The nested ParseObjects to fetch
- $useMasterKey : bool = false
-
Whether to override ACLs
Return values
array<string|int, mixed> —fetchWithInclude()
Fetch an array of Parse objects from the server.
public
fetchWithInclude(array<string|int, mixed> $includeKeys[, bool $useMasterKey = false ]) : ParseObject
Parameters
- $includeKeys : array<string|int, mixed>
-
The nested ParseObjects to fetch
- $useMasterKey : bool = false
-
Whether to override ACLs
Return values
ParseObject —Returns self, so you can chain this call.
get()
Get current value for an object property.
public
get(string $key) : mixed
Parameters
- $key : string
-
Key to retrieve from the estimatedData array.
Tags
Return values
mixed —getACL()
Get the ACL assigned to the object.
public
getACL() : ParseACL
Return values
ParseACL —getAllKeys()
Get values for all keys of an object.
public
getAllKeys() : array<string|int, mixed>
Return values
array<string|int, mixed> —getClassName()
Get the Parse Class Name for the object.
public
getClassName() : string
Return values
string —getCreatedAt()
Get the createdAt for the object, or null if unsaved.
public
getCreatedAt() : DateTime|null
Return values
DateTime|null —getName()
Returns the role name.
public
getName() : string
Return values
string —getObjectId()
Get the objectId for the object, or null if unsaved.
public
getObjectId() : string|null
Return values
string|null —getRegisteredSubclass()
Get the registered subclass for a Parse class, or a generic ParseObject if no subclass is registered.
public
static getRegisteredSubclass(string $parseClassName) : ParseObject
Parameters
- $parseClassName : string
Return values
ParseObject —getRelation()
Access or create a Relation value for a key.
public
getRelation(string $key[, string $className = null ]) : ParseRelation
Parameters
- $key : string
-
The key to access the relation for.
- $className : string = null
-
The target class name.
Return values
ParseRelation —The ParseRelation object if the relation already exists for the key or can be created for this key.
getRoles()
Gets the ParseRelation for the ParseRoles which are direct children of this role. These roles' users are granted any privileges that this role has been granted.
public
getRoles() : ParseRelation
Return values
ParseRelation —getUpdatedAt()
Get the updatedAt for the object, or null if unsaved.
public
getUpdatedAt() : DateTime|null
Return values
DateTime|null —getUsers()
Gets the ParseRelation for the ParseUsers which are direct children of this role. These users are granted any privileges that this role has been granted.
public
getUsers() : ParseRelation
Return values
ParseRelation —has()
Check if the object has a given key.
public
has(string $key) : bool
Parameters
- $key : string
-
Key to check
Return values
bool —hasRegisteredSubclass()
Check whether there is a subclass registered for a given parse class.
public
static hasRegisteredSubclass(string $parseClassName) : bool
Parameters
- $parseClassName : string
Return values
bool —increment()
Increment a numeric key by a certain value.
public
increment(string $key[, int $value = 1 ]) : mixed
Parameters
- $key : string
-
Key for numeric value on object to increment.
- $value : int = 1
-
Value to increment by.
Return values
mixed —isDataAvailable()
Returns true if the object has been fetched.
public
isDataAvailable() : bool
Return values
bool —isDirty()
Check if the object or any of its child objects have unsaved operations.
public
isDirty() : bool
Return values
bool —isKeyDirty()
Check if the a value associated with a key has been added/updated/removed and not saved yet.
public
isKeyDirty(string $key) : bool
Parameters
- $key : string
Return values
bool —query()
Creates a ParseQuery for the subclass of ParseObject.
public
static query() : ParseQuery
Cannot be called on the base class ParseObject.
Tags
Return values
ParseQuery —registerSubclass()
Register a subclass. Should be called before any other Parse functions.
public
static registerSubclass() : mixed
Cannot be called on the base class ParseObject.
Tags
Return values
mixed —remove()
Remove a value from an array for an object key.
public
remove(string $key, mixed $value) : mixed
Parameters
- $key : string
-
Key to remove the value from on the object.
- $value : mixed
-
Value to remove from the array.
Tags
Return values
mixed —revert()
Revert all unsaved operations.
public
revert() : mixed
Return values
mixed —save()
Handles pre-saving of this role Calls ParseObject::save to finish
public
save([bool $useMasterKey = false ]) : mixed
Parameters
- $useMasterKey : bool = false
Tags
Return values
mixed —saveAll()
Save all the objects in the provided array.
public
static saveAll(array<string|int, mixed> $list[, bool $useMasterKey = false ][, int $batchSize = 40 ]) : mixed
Parameters
- $list : array<string|int, mixed>
- $useMasterKey : bool = false
-
Whether to use the Master Key.
- $batchSize : int = 40
-
Number of objects to process per request
Return values
mixed —set()
Validate and set a value for an object key.
public
set(string $key, mixed $value) : mixed
Parameters
- $key : string
-
Key to set a value for on the object.
- $value : mixed
-
Value to set on the key.
Tags
Return values
mixed —setACL()
Set ACL for this object.
public
setACL(ParseACL $acl) : mixed
Parameters
- $acl : ParseACL
Return values
mixed —setArray()
Set an array value for an object key.
public
setArray(string $key, array<string|int, mixed> $value) : mixed
Parameters
- $key : string
-
Key to set the value for on the object.
- $value : array<string|int, mixed>
-
Value to set on the key.
Tags
Return values
mixed —setAssociativeArray()
Set an associative array value for an object key.
public
setAssociativeArray(string $key, array<string|int, mixed> $value) : mixed
Parameters
- $key : string
-
Key to set the value for on the object.
- $value : array<string|int, mixed>
-
Value to set on the key.
Tags
Return values
mixed —setName()
Sets the role name.
public
setName(string $name) : mixed
Parameters
- $name : string
-
The role name
Tags
Return values
mixed —_isDirty()
Detects if the object (and optionally the child objects) has unsaved changes.
protected
_isDirty(bool $considerChildren) : bool
Parameters
- $considerChildren : bool
-
Whether to consider children when checking for dirty state
Return values
bool —rebuildEstimatedData()
Start from serverData and process operations to generate the current value set for an object.
protected
rebuildEstimatedData() : mixed
Return values
mixed —_isDataAvailable()
Returns whether or not data is available for a given key
private
_isDataAvailable(string $key) : bool
Parameters
- $key : string
-
Key to check availability of
Return values
bool —applyOperations()
Apply operations to a target object.
private
applyOperations(array<string|int, mixed> $operations, array<string|int, mixed> &$target) : mixed
Parameters
- $operations : array<string|int, mixed>
-
Operations set to apply.
- $target : array<string|int, mixed>
-
Target data to affect.
Return values
mixed —canBeSerialized()
Determine if the current object can be serialized for saving.
private
canBeSerialized() : bool
Return values
bool —canBeSerializedAsValue()
Checks the given object and any children to see if the whole object can be serialized for saving.
private
static canBeSerializedAsValue(mixed $object) : bool
Parameters
- $object : mixed
-
The value to check.
Return values
bool —deepSave()
Save object and unsaved children within.
private
static deepSave(ParseObject|array<string|int, mixed> $target[, bool $useMasterKey = false ][, int $batchSize = 40 ]) : mixed
Parameters
- $target : ParseObject|array<string|int, mixed>
- $useMasterKey : bool = false
-
Whether to use the Master Key.
- $batchSize : int = 40
-
Number of objects to process per request
Tags
Return values
mixed —destroyBatch()
Destroy batch of objects.
private
static destroyBatch(array<string|int, ParseObject> $objects[, bool $useMasterKey = false ]) : array<string|int, mixed>
Parameters
- $objects : array<string|int, ParseObject>
- $useMasterKey : bool = false
Tags
Return values
array<string|int, mixed> —findUnsavedChildren()
Find unsaved children inside an object.
private
static findUnsavedChildren(ParseObject $object, array<string|int, mixed> &$unsavedChildren, array<string|int, mixed> &$unsavedFiles) : mixed
Parameters
- $object : ParseObject
-
Object to search.
- $unsavedChildren : array<string|int, mixed>
-
Array to populate with children.
- $unsavedFiles : array<string|int, mixed>
-
Array to populate with files.
Return values
mixed —getACLWithCopy()
Internally retrieves the ACL assigned to this object, conditionally returning a copy of the existing one
private
getACLWithCopy(bool $mayCopy) : ParseACL|null
Parameters
- $mayCopy : bool
-
Whether to return a copy of this acl or not
Return values
ParseACL|null —getSaveJSON()
Returns JSON object of the unsaved operations.
private
getSaveJSON() : array<string|int, mixed>
Return values
array<string|int, mixed> —getSubclass()
Gets the Subclass className if exists, otherwise false.
private
static getSubclass() : mixed
Return values
mixed —hasDirtyChildren()
Determines whether this object has child objects that are dirty
private
hasDirtyChildren() : bool
Return values
bool —mergeAfterSave()
Merge server data after a save completes.
private
mergeAfterSave(array<string|int, mixed> $result) : mixed
Parameters
- $result : array<string|int, mixed>
-
Data retrieved from server.
Return values
mixed —mergeFromObject()
Merge data from other object.
private
mergeFromObject(ParseObject $other) : mixed
Parameters
- $other : ParseObject
-
Other object to merge data from
Return values
mixed —mergeFromServer()
Merges data received from the server.
private
mergeFromServer(array<string|int, mixed> $data[, bool $completeData = true ]) : mixed
Parameters
- $data : array<string|int, mixed>
-
Data retrieved from server.
- $completeData : bool = true
-
Fetch all data or not.
Return values
mixed —toObjectIdArray()
Creates an array of object ids from a given array of ParseObjects
private
static toObjectIdArray(array<string|int, mixed> $objects) : array<string|int, mixed>
Parameters
- $objects : array<string|int, mixed>
-
Objects to create id array from
Tags
Return values
array<string|int, mixed> —traverse()
Traverse object to find children.
private
static traverse(bool $deep, ParseObject|array<string|int, mixed> &$object, callable $mapFunction[, array<string|int, mixed> $seen = [] ]) : mixed
Parameters
- $deep : bool
-
Should this call traverse deeply
- $object : ParseObject|array<string|int, mixed>
-
Object to traverse.
- $mapFunction : callable
-
Function to call for every item.
- $seen : array<string|int, mixed> = []
-
Objects already seen.
Return values
mixed —The result of calling mapFunction on the root object.
updateWithFetchedResults()
Merges an existing array of objects with their fetched counterparts
private
static updateWithFetchedResults(array<string|int, mixed> $objects, array<string|int, mixed> $fetched) : array<string|int, mixed>
Parameters
- $objects : array<string|int, mixed>
-
Original objects to update
- $fetched : array<string|int, mixed>
-
Fetched object data to update with