ParseUser

Extends \Parse\ParseObject

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

author

Fosco Marotto fjm@fb.com

package

Parse

Methods

Create a Parse Object.

__construct(string $className = null, mixed $objectId = null, boolean $isPointer = false) 
inherited

Creates a pointer object if an objectId is provided, otherwise creates a new object.

Throws
\Exception

Arguments

$className

string

Class Name for data on Parse.

$objectId

mixed

Object Id for Existing object.

$isPointer

boolean

Getter to catch direct property calls and pass them to the get function.

__get(string $key) : mixed
inherited

Arguments

$key

string

Key to retrieve from the Object.

Response

mixed

Magic handler to catch isset calls to object properties.

__isset(string $key) : boolean
inherited

Arguments

$key

string

Key to check on the object.

Response

boolean

Setter to catch property calls and protect certain fields.

__set(string $key, mixed $value) 
inherited
Throws
\Exception

Arguments

$key

string

Key to set a value on.

$value

mixed

Value to assign.

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

_clearCurrentUserVariable() 
static

Return a JSON encoded value of the object.

_encode() : string
inherited

Response

string

Returns whether or not data is available for a given key

_isDataAvailable(string $key) : boolean
inherited

Arguments

$key

string

Key to check availability of

Response

boolean

Detects if the object (and optionally the child objects) has unsaved changes.

_isDirty(boolean $considerChildren) : boolean
inherited

Arguments

$considerChildren

boolean

Whether to consider children when checking for dirty state

Response

boolean

Merges data received from the server.

_mergeAfterFetch(array $result, boolean $completeData = true) 
inherited

Arguments

$result

array

Data retrieved from the server.

$completeData

boolean

Fetch all data or not.

Merges data received from the server with a given selected keys.

_mergeAfterFetchWithSelectedKeys(array $result, array $selectedKeys) 
inherited

Arguments

$result

array

Data retrieved from the server.

$selectedKeys

array

Keys to be fetched. Null or empty means all data will be fetched.

Handle merging of special fields for the object.

_mergeMagicFields( &$data) 
inherited

Arguments

$data

Perform an operation on an object property.

_performOperation(string $key, \Parse\Internal\FieldOperation $operation) 
inherited

Arguments

$key

string

Key to perform an operation upon.

$operation

\Parse\Internal\FieldOperation

Operation to perform.

Gets a Pointer referencing this Object.

_toPointer() : array
inherited
Throws
\Exception

Response

array

Un-register a subclass.

_unregisterSubclass() 
inherited static

Cannot be called on the base class ParseObject.

Add a value to an array property.

add(string $key, mixed $value) 
inherited

Arguments

$key

string

Key for array value on object to add a value to.

$value

mixed

Value to add.

Add unique values to an array property.

addUnique(string $key, mixed $value) 
inherited

Arguments

$key

string

Key for array value on object.

$value

mixed

Value list to add uniquely.

Apply operations to a target object.

applyOperations(array $operations,  &$target) 
inherited

Arguments

$operations

array

Operations set to apply.

$target

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

become(string $sessionToken) : \Parse\ParseUser
static

Arguments

$sessionToken

string

Response

\Parse\ParseUser

Before save stub

beforeSave() : void
inherited

Determine if the current object can be serialized for saving.

canBeSerialized() : boolean
inherited

Response

boolean

Checks the given object and any children to see if the whole object can be serialized for saving.

canBeSerializedAsValue(mixed $object) : boolean
inherited static

Arguments

$object

mixed

The value to check.

Response

boolean

Clear all keys on this object by creating delete operations for each key.

clear() 
inherited

Static method which returns a new Parse Object for a given class Optionally creates a pointer object if the objectId is provided.

create(string $className, string $objectId = null, boolean $isPointer = false) : \Parse\ParseObject
inherited static

Arguments

$className

string

Class Name for data on Parse.

$objectId

string

Unique identifier for existing object.

$isPointer

boolean

If the object is a pointer.

Response

\Parse\ParseObject

Decodes and returns a ParseObject from an encoded object

decode(string|array $encoded) : \Parse\ParseObject
inherited static
Throws
\Parse\ParseException

Arguments

$encoded

string|array

Encoded ParseObject to decode

Response

\Parse\ParseObject

Save object and unsaved children within.

deepSave(\Parse\ParseObject|array $target, boolean $useMasterKey = false) 
inherited static
Throws
\Exception
\Parse\ParseAggregateException
\Parse\ParseException

Arguments

$target

\Parse\ParseObject|array

$useMasterKey

boolean

Whether to use the Master Key.

Delete a key from an object.

delete(string $key) 
inherited

Arguments

$key

string

Key to remove from object.

Delete the object from Parse.

destroy(boolean $useMasterKey = false) 
inherited

Arguments

$useMasterKey

boolean

Whether to use the master key.

Delete an array of objects.

destroyAll(array $objects, boolean $useMasterKey = false) 
inherited static
Throws
\Parse\ParseAggregateException

Arguments

$objects

array

Objects to destroy.

$useMasterKey

boolean

Whether to use the master key or not.

Destroy batch of objects.

destroyBatch(array<mixed,\Parse\ParseObject> $objects, boolean $useMasterKey = false) : array
inherited static
Throws
\Parse\ParseException

Arguments

$objects

array<mixed,\Parse\ParseObject>

$useMasterKey

boolean

Response

array

Returns a JSON encoded array of a ParseObject

encode() : string
inherited

Response

string

Fetch the whole object from the server and update the local object.

fetch(boolean $useMasterKey = false) : \Parse\ParseObject
inherited

Arguments

$useMasterKey

boolean

Whether to use the master key and override ACLs

Response

\Parse\ParseObject

Returns self, so you can chain this call.

Fetch an array of Parse objects from the server.

fetchAll(array $objects, boolean $useMasterKey = false) : array
inherited static

Arguments

$objects

array

The ParseObjects to fetch

$useMasterKey

boolean

Whether to override ACLs

Response

array

Find unsaved children inside an object.

findUnsavedChildren(\Parse\ParseObject $object,  &$unsavedChildren,  &$unsavedFiles) 
inherited static

Arguments

$object

\Parse\ParseObject

Object to search.

$unsavedChildren

$unsavedFiles

Get current value for an object property.

get(string $key) : mixed
inherited
Throws
\Exception

Arguments

$key

string

Key to retrieve from the estimatedData array.

Response

mixed

Get the ACL assigned to the object.

getACL() : \Parse\ParseACL
inherited

Response

\Parse\ParseACL

Internally retrieves the ACL assigned to this object, conditionally returning a copy of the existing one

getACLWithCopy(boolean $mayCopy) : \Parse\ParseACL
inherited

Arguments

$mayCopy

boolean

Whether to return a copy of this acl or not

Response

\Parse\ParseACL

Get values for all keys of an object.

getAllKeys() : array
inherited

Response

array

Get the Parse Class Name for the object.

getClassName() : string
inherited

Response

string

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

getCreatedAt() : \DateTime|null
inherited

Response

\DateTime|null

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

getCurrentUser() : \Parse\ParseUser|null
static

Response

\Parse\ParseUser|null

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

getEmail() : string|null

Response

string|null

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

getObjectId() : string|null
inherited

Response

string|null

Get the registered subclass for a Parse class, or a generic ParseObject if no subclass is registered.

getRegisteredSubclass( $parseClassName) : \Parse\ParseObject
inherited static

Arguments

$parseClassName

Response

\Parse\ParseObject

Access or create a Relation value for a key.

getRelation(string $key, string $className = null) : \Parse\ParseRelation
inherited

Arguments

$key

string

The key to access the relation for.

$className

string

The target class name.

Response

\Parse\ParseRelation

The ParseRelation object if the relation already exists for the key or can be created for this key.

Returns JSON object of the unsaved operations.

getSaveJSON() : array
inherited

Response

array

Returns the session token, if available.

getSessionToken() : string|null

Response

string|null

Gets the Subclass className if exists, otherwise false.

getSubclass() 
inherited static

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

getUpdatedAt() : \DateTime|null
inherited

Response

\DateTime|null

Returns the username.

getUsername() : string|null

Response

string|null

After a save, perform User object specific logic.

handleSaveResult(boolean $makeCurrent = false) 

Arguments

$makeCurrent

boolean

Whether to set the current user.

Check if the object has a given key.

has(string $key) : boolean
inherited

Arguments

$key

string

Key to check

Response

boolean

Determines whether this object has child objects that are dirty

hasDirtyChildren() : boolean
inherited

Response

boolean

Check whether there is a subclass registered for a given parse class.

hasRegisteredSubclass( $parseClassName) : boolean
inherited static

Arguments

$parseClassName

Response

boolean

Increment a numeric key by a certain value.

increment(string $key, integer $value = 1) 
inherited

Arguments

$key

string

Key for numeric value on object to increment.

$value

integer

Value to increment by.

Checks whether this user has been authenticated.

isAuthenticated() : boolean

Response

boolean

Returns true if this user is the current user.

isCurrent() : boolean

Response

boolean

Returns true if the object has been fetched.

isDataAvailable() : boolean
inherited

Response

boolean

Check if the object or any of its child objects have unsaved operations.

isDirty() : boolean
inherited

Response

boolean

Check if the a value associated with a key has been added/updated/removed and not saved yet.

isKeyDirty(string $key) : boolean
inherited

Arguments

$key

string

Response

boolean

Link the user with a service.

linkWith(string $serviceName, array $authData, boolean $useMasterKey = false) : \Parse\ParseUser

Arguments

$serviceName

string

the name of the service

$authData

array

the array of auth data for $serviceName

$useMasterKey

boolean

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

Response

\Parse\ParseUser

Link the user with Facebook details.

linkWithFacebook(string $id, string $access_token, \DateTime $expiration_date = null, boolean $useMasterKey = false) : \Parse\ParseUser
Throws
\Parse\ParseException

Arguments

$id

string

the Facebook user identifier

$access_token

string

the access token for this session

$expiration_date

\DateTime

defaults to 60 days

$useMasterKey

boolean

whether to override security

Response

\Parse\ParseUser

Link the user with Twitter details.

linkWithTwitter(string $id, string $screen_name, string $consumer_key, string $consumer_secret = null, string $auth_token, string $auth_token_secret, boolean $useMasterKey = false) : \Parse\ParseUser
Throws
\Parse\ParseException

Arguments

$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

the application's consumer secret

$auth_token

string

the authorized Twitter token for the user

$auth_token_secret

string

the secret associated with $auth_token

$useMasterKey

boolean

whether to override security

Response

\Parse\ParseUser

Logs in with a service.

logInWith(string $serviceName, array $authData) : \Parse\ParseUser
static

Arguments

$serviceName

string

the name of the service

$authData

array

the array of auth data for $serviceName

Response

\Parse\ParseUser

Login as an anonymous User with REST API. See docs http://parseplatform.org/docs/php/guide/#users

loginWithAnonymous() : \Parse\ParseUser
static

Logs in with Facebook details, or throws if invalid.

logInWithFacebook(string $id, string $access_token, \DateTime $expiration_date = null) : \Parse\ParseUser
static
Throws
\Parse\ParseException

Arguments

$id

string

the Facebook user identifier

$access_token

string

the access token for this session

$expiration_date

\DateTime

defaults to 60 days

Response

\Parse\ParseUser

Logs in with Twitter details, or throws if invalid.

logInWithTwitter(string $id, string $screen_name, string $consumer_key, string $consumer_secret = null, string $auth_token, string $auth_token_secret) : \Parse\ParseUser
static
Throws
\Parse\ParseException

Arguments

$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

the application's consumer secret

$auth_token

string

the authorized Twitter token for the user

$auth_token_secret

string

the secret associated with $auth_token

Response

\Parse\ParseUser

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

logOut() 
static

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

Merge server data after a save completes.

mergeAfterSave(array $result) 
inherited

Arguments

$result

array

Data retrieved from server.

Merge data from other object.

mergeFromObject(\Parse\ParseObject $other) 
inherited

Arguments

$other

\Parse\ParseObject

Other object to merge data from

Merges data received from the server.

mergeFromServer(array $data, boolean $completeData = true) 
inherited

Arguments

$data

array

Data retrieved from server.

$completeData

boolean

Fetch all data or not.

Creates a ParseQuery for the subclass of ParseObject.

query() : \Parse\ParseQuery
inherited static

Cannot be called on the base class ParseObject.

Throws
\Exception

Response

\Parse\ParseQuery

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

rebuildEstimatedData() 
inherited

Register a subclass. Should be called before any other Parse functions.

registerSubclass() 
inherited static

Cannot be called on the base class ParseObject.

Throws
\Exception

Remove a value from an array for an object key.

remove(string $key, mixed $value) 
inherited
Throws
\Exception

Arguments

$key

string

Key to remove the value from on the object.

$value

mixed

Value to remove from the array.

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.

requestPasswordReset(string $email) 
static

Arguments

$email

string

Revert all unsaved operations.

revert() 
inherited

Save Object to Parse.

save(boolean $useMasterKey = false) 
inherited

Arguments

$useMasterKey

boolean

Whether to use the Master Key.

Save all the objects in the provided array.

saveAll(array $list, boolean $useMasterKey = false) 
inherited static

Arguments

$list

array

$useMasterKey

boolean

Whether to use the Master Key.

Persists the current user to the storage provider.

saveCurrentUser() 
static

Validate and set a value for an object key.

set(string $key, mixed $value) 
inherited
Throws
\Exception

Arguments

$key

string

Key to set a value for on the object.

$value

mixed

Value to set on the key.

Set ACL for this object.

setACL(\Parse\ParseACL $acl) 
inherited

Arguments

Set an array value for an object key.

setArray(string $key, array $value) 
inherited
Throws
\Exception

Arguments

$key

string

Key to set the value for on the object.

$value

array

Value to set on the key.

Set an associative array value for an object key.

setAssociativeArray(string $key, array $value) 
inherited
Throws
\Exception

Arguments

$key

string

Key to set the value for on the object.

$value

array

Value to set on the key.

Sets the email address for the ParseUser.

setEmail(string $email) 

Arguments

$email

string

The email address

Sets the password for the ParseUser.

setPassword(string $password) 

Arguments

$password

string

The password

Sets the username for the ParseUser.

setUsername(string $username) 

Arguments

$username

string

The username

Creates an array of object ids from a given array of ParseObjects

toObjectIdArray(array $objects) : array
inherited static
Throws
\Parse\ParseException

Arguments

$objects

array

Objects to create id array from

Response

array

Traverse object to find children.

traverse(boolean $deep,  &$object, callable $mapFunction, array $seen = array()) : mixed
inherited static

Arguments

$deep

boolean

Should this call traverse deeply

$object

$mapFunction

callable

Function to call for every item.

$seen

array

Objects already seen.

Response

mixed

The result of calling mapFunction on the root object.

Merges an existing array of objects with their fetched counterparts

updateWithFetchedResults(array $objects, array $fetched) : array
inherited static
Throws
\Parse\ParseException

Arguments

$objects

array

Original objects to update

$fetched

array

Fetched object data to update with

Response

array

Properties

Parse Class name

parseClassName : string
static
var

Type(s)

string

The currently logged-in user.

currentUser : \Parse\ParseUser
static
var

Type(s)

\Parse\ParseUser

The sessionToken for an authenticated user.

_sessionToken : string
var

Type(s)

string

Data as it exists on the server.

serverData : array
inherited
var

Type(s)

array

Set of unsaved operations.

operationSet : array
inherited
var

Type(s)

array

Estimated value of applying operationSet to serverData.

estimatedData : array
inherited
var

Type(s)

array

Determine if data available for a given key or not.

dataAvailability : array
inherited
var

Type(s)

array

Class name for data on Parse.

className : string
inherited
var

Type(s)

string

Unique identifier on Parse.

objectId : string
inherited
var

Type(s)

string

Timestamp when object was created.

createdAt : \DateTime
inherited
var

Type(s)

\DateTime

Timestamp when object was last updated.

updatedAt : \DateTime
inherited
var

Type(s)

\DateTime

Whether the object has been fully fetched from Parse.

hasBeenFetched : boolean
inherited
var

Type(s)

boolean

Holds the registered subclasses and Parse class names.

registeredSubclasses : array
inherited static
var

Type(s)

array