Parse PHP SDK API Reference

ParseUser extends ParseObject
in package

Class ParseUser - Representation of a user object stored on Parse.

Tags
author

Fosco Marotto [email protected]

Table of Contents

$parseClassName  : string
Parse Class name
$_sessionToken  : string
The sessionToken for an authenticated user.
$currentUser  : ParseUser
The currently logged-in user.
$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.
_clearCurrentUserVariable()  : mixed
Sets the current user to null. Used internally for testing purposes.
_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.
become()  : ParseUser
Logs in a user with a session token. Calls the /users/me route and if valid, creates and returns the current user.
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.
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.
getCurrentUser()  : ParseUser|null
Retrieves the currently logged in ParseUser with a valid session, either from memory or the storage provider, if necessary.
getEmail()  : string|null
Returns the email address, if set, for the ParseUser.
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.
getSessionToken()  : string|null
Returns the session token, if available.
getUpdatedAt()  : DateTime|null
Get the updatedAt for the object, or null if unsaved.
getUsername()  : string|null
Returns the username.
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.
isAuthenticated()  : bool
Checks whether this user has been authenticated.
isCurrent()  : bool
Returns true if this user is the current user.
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.
linkWith()  : ParseUser
Link the user with a service.
linkWithFacebook()  : ParseUser
Link the user with Facebook details.
linkWithTwitter()  : ParseUser
Link the user with Twitter details.
logIn()  : ParseUser
Logs in and returns a valid ParseUser, or throws if invalid.
logInAs()  : ParseUser
Uses the master key to log in and return a valid ParseUser, or throws if invalid.
logInWith()  : ParseUser
Logs in with a service.
loginWithAnonymous()  : ParseUser
Login as an anonymous User with REST API. See docs http://parseplatform.org/docs/php/guide/#users
logInWithFacebook()  : ParseUser
Logs in with Facebook details, or throws if invalid.
logInWithTwitter()  : ParseUser
Logs in with Twitter details, or throws if invalid.
logOut()  : mixed
Log out the current user. This will clear the storage and future calls to current will return null.
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.
requestPasswordReset()  : mixed
Requests a password reset email to be sent to the specified email address associated with the user account. This email allows the user to securely reset their password on the Parse site.
requestVerificationEmail()  : mixed
Request a verification email to be sent to the specified email address
revert()  : mixed
Revert all unsaved operations.
save()  : mixed
Save the current user object, unless it is not signed up.
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.
setEmail()  : mixed
Sets the email address for the ParseUser.
setPassword()  : mixed
Sets the password for the ParseUser.
setUsername()  : mixed
Sets the username for the ParseUser.
signUp()  : mixed
Signs up the current user, or throw if invalid.
_isDirty()  : bool
Detects if the object (and optionally the child objects) has unsaved changes.
handleSaveResult()  : mixed
After a save, perform User object specific logic.
rebuildEstimatedData()  : mixed
Start from serverData and process operations to generate the current value set for an object.
saveCurrentUser()  : mixed
Persists the current user to the storage provider.
_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.
clearAnonymousAuthData()  : mixed
Remove current user's anonymous AuthData
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 = '_User'

$_sessionToken

The sessionToken for an authenticated user.

protected string $_sessionToken = null

$currentUser

The currently logged-in user.

protected static ParseUser $currentUser = null

$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
throws
Exception
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
throws
Exception
Return values
mixed

_clearCurrentUserVariable()

Sets the current user to null. Used internally for testing purposes.

public static _clearCurrentUserVariable() : mixed
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
throws
Exception
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

become()

Logs in a user with a session token. Calls the /users/me route and if valid, creates and returns the current user.

public static become(string $sessionToken) : ParseUser
Parameters
$sessionToken : string
Return values
ParseUser

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

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
throws
ParseException
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
throws
ParseAggregateException
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
throws
Exception
Return values
mixed

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

getCurrentUser()

Retrieves the currently logged in ParseUser with a valid session, either from memory or the storage provider, if necessary.

public static getCurrentUser() : ParseUser|null
Return values
ParseUser|null

getEmail()

Returns the email address, if set, for the ParseUser.

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

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.

getSessionToken()

Returns the session token, if available.

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

getUpdatedAt()

Get the updatedAt for the object, or null if unsaved.

public getUpdatedAt() : DateTime|null
Return values
DateTime|null

getUsername()

Returns the username.

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

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

isAuthenticated()

Checks whether this user has been authenticated.

public isAuthenticated() : bool
Return values
bool

isCurrent()

Returns true if this user is the current user.

public isCurrent() : bool
Return values
bool

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

linkWith()

Link the user with a service.

public linkWith(string $serviceName, array<string|int, mixed> $authData[, bool $useMasterKey = false ]) : ParseUser
Parameters
$serviceName : string

the name of the service

$authData : array<string|int, mixed>

the array of auth data for $serviceName

$useMasterKey : bool = false

Whether or not to use the master key, default is false

Return values
ParseUser

linkWithFacebook()

Link the user with Facebook details.

public linkWithFacebook(string $id, string $access_token[, DateTime $expiration_date = null ][, bool $useMasterKey = false ]) : ParseUser
Parameters
$id : string

the Facebook user identifier

$access_token : string

the access token for this session

$expiration_date : DateTime = null

defaults to 60 days

$useMasterKey : bool = false

whether to override security

Tags
throws
ParseException
Return values
ParseUser

linkWithTwitter()

Link the user with Twitter details.

public linkWithTwitter(string $id, string $screen_name, string $consumer_key[, string $consumer_secret = null ][, string $auth_token = null ][, string $auth_token_secret = null ][, bool $useMasterKey = false ]) : ParseUser
Parameters
$id : string

the Twitter user identifier

$screen_name : string

the user's Twitter handle

$consumer_key : string

the application's consumer key

$consumer_secret : string = null

the application's consumer secret

$auth_token : string = null

the authorized Twitter token for the user

$auth_token_secret : string = null

the secret associated with $auth_token

$useMasterKey : bool = false

whether to override security

Tags
throws
ParseException
Return values
ParseUser

logIn()

Logs in and returns a valid ParseUser, or throws if invalid.

public static logIn(string $username, string $password) : ParseUser
Parameters
$username : string
$password : string
Tags
throws
ParseException
Return values
ParseUser

logInAs()

Uses the master key to log in and return a valid ParseUser, or throws if invalid.

public static logInAs(mixed $userId) : ParseUser
Parameters
$userId : mixed
Tags
$userId

@param

throws
ParseException
Return values
ParseUser

logInWith()

Logs in with a service.

public static logInWith(string $serviceName, array<string|int, mixed> $authData) : ParseUser
Parameters
$serviceName : string

the name of the service

$authData : array<string|int, mixed>

the array of auth data for $serviceName

Return values
ParseUser

logInWithFacebook()

Logs in with Facebook details, or throws if invalid.

public static logInWithFacebook(string $id, string $access_token[, DateTime $expiration_date = null ]) : ParseUser
Parameters
$id : string

the Facebook user identifier

$access_token : string

the access token for this session

$expiration_date : DateTime = null

defaults to 60 days

Tags
throws
ParseException
Return values
ParseUser

logInWithTwitter()

Logs in with Twitter details, or throws if invalid.

public static logInWithTwitter(string $id, string $screen_name, string $consumer_key[, string $consumer_secret = null ][, string $auth_token = null ][, string $auth_token_secret = null ]) : ParseUser
Parameters
$id : string

the Twitter user identifier

$screen_name : string

the user's Twitter handle

$consumer_key : string

the application's consumer key

$consumer_secret : string = null

the application's consumer secret

$auth_token : string = null

the authorized Twitter token for the user

$auth_token_secret : string = null

the secret associated with $auth_token

Tags
throws
ParseException
Return values
ParseUser

logOut()

Log out the current user. This will clear the storage and future calls to current will return null.

public static logOut() : mixed

This will make a network request to logout to invalidate the session.

Return values
mixed

query()

Creates a ParseQuery for the subclass of ParseObject.

public static query() : ParseQuery

Cannot be called on the base class ParseObject.

Tags
throws
Exception
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
throws
Exception
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
throws
Exception
Return values
mixed

requestPasswordReset()

Requests a password reset email to be sent to the specified email address associated with the user account. This email allows the user to securely reset their password on the Parse site.

public static requestPasswordReset(string $email) : mixed
Parameters
$email : string
Return values
mixed

requestVerificationEmail()

Request a verification email to be sent to the specified email address

public static requestVerificationEmail(string $email) : mixed
Parameters
$email : string

Email to request a verification for

Return values
mixed

revert()

Revert all unsaved operations.

public revert() : mixed
Return values
mixed

save()

Save the current user object, unless it is not signed up.

public save([bool $useMasterKey = false ]) : mixed
Parameters
$useMasterKey : bool = false

Whether to use the Master Key

Tags
throws
ParseException
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
throws
Exception
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
throws
Exception
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
throws
Exception
Return values
mixed

setEmail()

Sets the email address for the ParseUser.

public setEmail(string $email) : mixed
Parameters
$email : string

The email address

Return values
mixed

setPassword()

Sets the password for the ParseUser.

public setPassword(string $password) : mixed
Parameters
$password : string

The password

Return values
mixed

setUsername()

Sets the username for the ParseUser.

public setUsername(string $username) : mixed
Parameters
$username : string

The username

Return values
mixed

signUp()

Signs up the current user, or throw if invalid.

public signUp() : mixed

This will create a new ParseUser on the server, and also persist the session so that you can access the user using ParseUser::getCurrentUser();.

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

handleSaveResult()

After a save, perform User object specific logic.

protected handleSaveResult([bool $makeCurrent = false ]) : mixed
Parameters
$makeCurrent : bool = false

Whether to set the current user.

Return values
mixed

rebuildEstimatedData()

Start from serverData and process operations to generate the current value set for an object.

protected rebuildEstimatedData() : mixed
Return values
mixed

saveCurrentUser()

Persists the current user to the storage provider.

protected static saveCurrentUser() : 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

clearAnonymousAuthData()

Remove current user's anonymous AuthData

private clearAnonymousAuthData() : mixed
Return values
mixed

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
throws
Exception
throws
ParseAggregateException
throws
ParseException
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
throws
ParseException
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
throws
ParseException
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

Tags
throws
ParseException
Return values
array<string|int, mixed>

Search results