PHP Class ElggEntity, Elgg

Author: Curverider Ltd ([email protected])
Inheritance: implements Notable, implements Locatable, implements Exportable, implements Importable, implements Loggable, implements Iterator, implements ArrayAccess
Show file Open project: elgg/elgg Class Usage Examples

Protected Properties

Property Type Description
$orig_attributes Holds the original (persisted) attribute values that have been changed but not yet saved.
$temp_annotations Holds annotations until entity is saved. Once the entity is saved, annotations are written immediately to the database.
$temp_metadata Holds metadata until entity is saved. Once the entity is saved, metadata are written immediately to the database.
$temp_private_settings Holds private settings until entity is saved. Once the entity is saved, private settings are written immediately to the database.
$url_override If set, overrides the value of getURL()
$volatile Volatile data structure for this object, allows for storage of data in-memory that isn't sync'd back to the metadata table.

Public Methods

Method Description
__clone ( ) : void Clone an entity
__get ( string $name ) : mixed Get an attribute or metadata value
__set ( string $name, mixed $value ) : void Set an attribute or metadata value for this entity
__unset ( string $name ) : void Unset a property from metadata or attribute.
addRelationship ( integer $guid_two, string $relationship ) : boolean Add a relationship between this an another entity.
annotate ( string $name, mixed $value, integer $access_id = ACCESS_PRIVATE, integer $owner_guid, string $vartype = "" ) : boolean | integer Adds an annotation to an entity.
canAnnotate ( integer $user_guid, string $annotation_name = '' ) : boolean Can a user annotate an entity?
canComment ( integer $user_guid, boolean $default = null ) : boolean Can a user comment on an entity?
canDelete ( integer $user_guid ) : boolean Can a user delete this entity?
canEdit ( integer $user_guid ) : boolean Can a user edit this entity?
canEditMetadata ( ElggMetadata $metadata = null, integer $user_guid ) : boolean Can a user edit metadata on this entity?
canWriteToContainer ( integer $user_guid, string $type = 'all', string $subtype = 'all' ) : boolean Can a user add an entity to this container
countAnnotations ( string $name = "" ) : integer Count annotations.
countComments ( ) : integer Count the number of comments attached to this entity.
countEntitiesFromRelationship ( string $relationship, boolean $inverse_relationship = false ) : integer | false Gets the number of entities from a specific relationship type
delete ( boolean $recursive = true ) : boolean Deletes the entity.
deleteAccessCollectionMemberships ( ) : boolean Remove the membership of all access collections for this entity (if the entity is a user)
deleteAnnotations ( null | string $name = null ) : boolean Deletes all annotations on this object (annotations.entity_guid = $this->guid).
deleteIcon ( string $type = 'icon' ) : boolean Removes all icon files and metadata for the passed type of icon.
deleteMetadata ( null | string $name = null ) : boolean Deletes all metadata on this object (metadata.entity_guid = $this->guid).
deleteOwnedAccessCollections ( ) : boolean Remove all access collections owned by this entity
deleteOwnedAnnotations ( null | string $name = null ) : boolean Deletes all annotations owned by this object (annotations.owner_guid = $this->guid).
deleteOwnedMetadata ( null | string $name = null ) : boolean Deletes all metadata owned by this object (metadata.owner_guid = $this->guid).
deleteRelationships ( null | string $relationship = null ) : boolean Remove all relationships to and from this entity.
disable ( string $reason = "", boolean $recursive = true ) : boolean Disable this entity.
disableAnnotations ( string $name = '' ) : boolean Disables annotations for this entity, optionally based on name.
disableMetadata ( string $name = '' ) : boolean Disables metadata for this entity, optionally based on name.
enable ( boolean $recursive = true ) : boolean Enable the entity
enableAnnotations ( string $name = '' ) : boolean Enables annotations for this entity, optionally based on name.
enableMetadata ( string $name = '' ) : boolean Enables metadata for this entity, optionally based on name.
getAccessID ( ) : integer Returns the access_id.
getAnnotations ( array $options = [] ) : array Gets an array of annotations.
getAnnotationsAvg ( string $name ) : integer Get the average of an integer type annotation.
getAnnotationsMax ( string $name ) : integer Get the maximum of integer type annotations of a given name.
getAnnotationsMin ( string $name ) : integer Get the minimum of integer type annotations of given name.
getAnnotationsSum ( string $name ) : integer Get the sum of integer type annotations of a given name.
getContainerEntity ( ) : ElggEntity Get the container entity for this object.
getContainerGUID ( ) : integer Gets the container GUID for this entity.
getDisplayName ( ) : string Get the entity's display name
getEntitiesFromRelationship ( array $options = [] ) : array | false Gets an array of entities with a relationship to this entity.
getGUID ( ) : integer | null Returns the guid.
getIcon ( string $size, string $type = 'icon' ) : ElggIcon Returns entity icon as an ElggIcon object The icon file may or may not exist on filestore
getIconLastChange ( string $size, string $type = 'icon' ) : integer | null Returns the timestamp of when the icon was changed.
getIconURL ( mixed $params = [] ) : string Get the URL for this entity's icon
getLatitude ( ) : float Return the entity's latitude.
getLocation ( ) : string Gets the 'location' metadata for the entity
getLongitude ( ) : float Return the entity's longitude
getMetadata ( string $name ) : mixed Return the value of a piece of metadata.
getObjectFromID ( integer $id ) : integer For a given ID, return the object associated with it.
getOriginalAttributes ( ) : array Get the original values of attribute(s) that have been modified since the entity was persisted.
getOwnerEntity ( ) : ElggEntity Gets the \ElggEntity that owns this entity.
getOwnerGUID ( ) : integer Get the guid of the entity's owner.
getPrivateSetting ( string $name ) : mixed Returns a private setting value
getSubtype ( ) : string Get the entity subtype
getSystemLogID ( ) : integer Return an identification for the object for storage in the system log.
getTags ( array $tag_names = null ) : array Returns tags for this entity.
getTimeUpdated ( ) : integer Returns the UNIX epoch time that this entity was last updated
getType ( ) : string Returns the entity type
getURL ( ) : string Gets the URL for this entity.
getVolatileData ( string $name ) : mixed Get a piece of volatile (non-persisted) data on this entity.
hasIcon ( string $size, string $type = 'icon' ) : boolean Returns if the entity has an icon of the passed type.
isEnabled ( ) : boolean Is this entity enabled?
isFullyLoaded ( ) : boolean Tests to see whether the object has been persisted.
refresh ( stdClass $row ) : boolean Load new data from database into existing entity. Overwrites data but does not change values not included in the latest data.
removePrivateSetting ( string $name ) : boolean Removes private setting
removeRelationship ( integer $guid_two, string $relationship ) : boolean Remove a relationship
save ( ) : boolean | integer Save an entity.
saveIconFromElggFile ( ElggFile $file, string $type = 'icon', array $coords = [] ) : boolean Saves icons using a file located in the data store as the source.
saveIconFromLocalFile ( string $filename, string $type = 'icon', array $coords = [] ) : boolean Saves icons using a local file as the source.
saveIconFromUploadedFile ( string $input_name, string $type = 'icon', array $coords = [] ) : boolean Saves icons using an uploaded file as the source.
setContainerGUID ( integer $container_guid ) : boolean Set the container for this object.
setDisplayName ( string $displayName ) : void Sets the title or name of this entity.
setLatLong ( float $lat, float $long ) : void Set latitude and longitude metadata tags for a given entity.
setLocation ( string $location ) : void Sets the 'location' metadata for the entity
setMetadata ( string $name, mixed $value, string $value_type = '', boolean $multiple = false, integer $owner_guid, integer $access_id = null ) : boolean Set metadata on this entity.
setPrivateSetting ( string $name, mixed $value ) : boolean Adds a private setting to this entity.
setVolatileData ( string $name, mixed $value ) : void Set a piece of volatile (non-persisted) data on this entity
storeInPersistedCache ( ElggSharedMemoryCache $cache, integer $last_action ) : void Cache the entity in a persisted cache
toObject ( )
updateLastAction ( integer $posted = null ) : integer | false Update the last_action column in the entities table.

Protected Methods

Method Description
create ( ) : integer Create a new entry in the entities table.
initializeAttributes ( ) : void Initialize the attributes array.
load ( mixed $guid ) : boolean Loads attributes from the entities table into the object.
loadAdditionalSelectValues ( array $data ) : void Stores non-attributes from the loading of the entity as volatile data
prepareObject ( stdClass $object ) : stdClass Prepare an object copy for toObject()
update ( ) : boolean Update the entity in the database.

Private Methods

Method Description
getAnnotationCalculation ( string $name, string $calculation ) : mixed Helper function to return annotation calculation results

Method Details

__clone() public method

Resets the guid so that the entity can be saved as a distinct entity from the original. Creation time will be set when this new entity is saved. The owner and container guids come from the original entity. The clone method copies metadata but does not copy annotations or private settings.
public __clone ( ) : void
return void

__get() public method

If the name matches an attribute, the attribute is returned. If metadata does not exist with that name, a null is returned. This only returns an array if there are multiple values for a particular $name key.
public __get ( string $name ) : mixed
$name string Name of the attribute or metadata
return mixed

__set() public method

Anything that is not an attribute is saved as metadata.
See also: ElggEntity::setMetadata()
public __set ( string $name, mixed $value ) : void
$name string Name of the attribute or metadata
$value mixed The value to be set
return void

__unset() public method

Unset a property from metadata or attribute.
public __unset ( string $name ) : void
$name string The name of the attribute or metadata.
return void

addRelationship() public method

Add a relationship between this an another entity.
See also: ElggEntity::removeRelationship()
See also: ElggEntity::deleteRelationships()
public addRelationship ( integer $guid_two, string $relationship ) : boolean
$guid_two integer GUID of the target entity of the relationship.
$relationship string The type of relationship.
return boolean

annotate() public method

Adds an annotation to an entity.
public annotate ( string $name, mixed $value, integer $access_id = ACCESS_PRIVATE, integer $owner_guid, string $vartype = "" ) : boolean | integer
$name string Annotation name
$value mixed Annotation value
$access_id integer Access ID
$owner_guid integer GUID of the annotation owner
$vartype string The type of annotation value
return boolean | integer Returns int if an annotation is saved

canAnnotate() public method

Can a user annotate an entity?
public canAnnotate ( integer $user_guid, string $annotation_name = '' ) : boolean
$user_guid integer User guid (default is logged in user)
$annotation_name string The name of the annotation (default is unspecified)
return boolean

canComment() public method

Can a user comment on an entity?
public canComment ( integer $user_guid, boolean $default = null ) : boolean
$user_guid integer User guid (default is logged in user)
$default boolean Default permission
return boolean

canDelete() public method

Can a user delete this entity?
See also: elgg_set_ignore_access()
Since: 1.11
public canDelete ( integer $user_guid ) : boolean
$user_guid integer The user GUID, optionally (default: logged in user)
return boolean Whether this entity is deletable by the given user.

canEdit() public method

Can a user edit this entity?
See also: elgg_set_ignore_access()
public canEdit ( integer $user_guid ) : boolean
$user_guid integer The user GUID, optionally (default: logged in user)
return boolean Whether this entity is editable by the given user.

canEditMetadata() public method

If no specific metadata is passed, it returns whether the user can edit any metadata on the entity.
See also: elgg_set_ignore_access()
public canEditMetadata ( ElggMetadata $metadata = null, integer $user_guid ) : boolean
$metadata ElggMetadata The piece of metadata to specifically check or null for any metadata
$user_guid integer The user GUID, optionally (default: logged in user)
return boolean

canWriteToContainer() public method

Can a user add an entity to this container
See also: elgg_set_ignore_access()
public canWriteToContainer ( integer $user_guid, string $type = 'all', string $subtype = 'all' ) : boolean
$user_guid integer The GUID of the user creating the entity (0 for logged in user).
$type string The type of entity we're looking to write
$subtype string The subtype of the entity we're looking to write
return boolean

countAnnotations() public method

Count annotations.
public countAnnotations ( string $name = "" ) : integer
$name string The type of annotation.
return integer

countComments() public method

Count the number of comments attached to this entity.
Since: 1.8.0
public countComments ( ) : integer
return integer Number of comments

countEntitiesFromRelationship() public method

Gets the number of entities from a specific relationship type
public countEntitiesFromRelationship ( string $relationship, boolean $inverse_relationship = false ) : integer | false
$relationship string Relationship type (eg "friends")
$inverse_relationship boolean Invert relationship
return integer | false The number of entities or false on failure

create() protected method

Saves the base information in the entities table for the entity. Saving the type-specific information is handled in the calling class method.
protected create ( ) : integer
return integer The new entity's GUID

delete() public method

Removes the entity and its metadata, annotations, relationships, river entries, and private data. Optionally can remove entities contained and owned by this entity.
public delete ( boolean $recursive = true ) : boolean
$recursive boolean If true (default) then all entities which are owned or contained by $this will also be deleted.
return boolean

deleteAccessCollectionMemberships() public method

Remove the membership of all access collections for this entity (if the entity is a user)
Since: 1.11

deleteAnnotations() public method

If you pass a name, only annotations matching that name will be deleted.
Since: 1.8
public deleteAnnotations ( null | string $name = null ) : boolean
$name null | string The annotations name to remove.
return boolean

deleteIcon() public method

Removes all icon files and metadata for the passed type of icon.
public deleteIcon ( string $type = 'icon' ) : boolean
$type string The name of the icon. e.g., 'icon', 'cover_photo'
return boolean

deleteMetadata() public method

If you pass a name, only metadata matching that name will be deleted.
Since: 1.8
public deleteMetadata ( null | string $name = null ) : boolean
$name null | string The name of the metadata to remove.
return boolean

deleteOwnedAccessCollections() public method

Remove all access collections owned by this entity
Since: 1.11

deleteOwnedAnnotations() public method

If you pass a name, only annotations matching that name will be deleted.
Since: 1.8
public deleteOwnedAnnotations ( null | string $name = null ) : boolean
$name null | string The name of annotations to delete.
return boolean

deleteOwnedMetadata() public method

If you pass a name, only metadata matching that name will be deleted.
Since: 1.8
public deleteOwnedMetadata ( null | string $name = null ) : boolean
$name null | string The name of metadata to delete.
return boolean

deleteRelationships() public method

If you pass a relationship name, only relationships matching that name will be deleted.
See also: ElggEntity::addRelationship()
See also: ElggEntity::removeRelationship()
public deleteRelationships ( null | string $relationship = null ) : boolean
$relationship null | string The name of the relationship to remove.
return boolean

disable() public method

Disabled entities are not returned by getter functions. To enable an entity, use {@link \ElggEntity::enable()}. Recursively disabling an entity will disable all entities owned or contained by the parent entity. You can ignore the disabled field by using {@link access_show_hidden_entities()}.
See also: ElggEntity::enable()
public disable ( string $reason = "", boolean $recursive = true ) : boolean
$reason string Optional reason
$recursive boolean Recursively disable all contained entities?
return boolean

disableAnnotations() public method

Disables annotations for this entity, optionally based on name.
Since: 1.8
public disableAnnotations ( string $name = '' ) : boolean
$name string An options name of annotations to disable.
return boolean

disableMetadata() public method

Disables metadata for this entity, optionally based on name.
Since: 1.8
public disableMetadata ( string $name = '' ) : boolean
$name string An options name of metadata to disable.
return boolean

enable() public method

Enable the entity
See also: access_show_hiden_entities()
public enable ( boolean $recursive = true ) : boolean
$recursive boolean Recursively enable all entities disabled with the entity?
return boolean

enableAnnotations() public method

Enables annotations for this entity, optionally based on name.
Since: 1.8
public enableAnnotations ( string $name = '' ) : boolean
$name string An options name of annotations to enable.
return boolean

enableMetadata() public method

Enables metadata for this entity, optionally based on name.
Since: 1.8
public enableMetadata ( string $name = '' ) : boolean
$name string An options name of metadata to enable.
return boolean

getAccessID() public method

Returns the access_id.
public getAccessID ( ) : integer
return integer The access ID

getAnnotations() public method

To retrieve annotations on an unsaved entity, pass array('name' => [annotation name]) as the options array.
See also: elgg_get_annotations()
public getAnnotations ( array $options = [] ) : array
$options array Array of options for elgg_get_annotations() except guid.
return array

getAnnotationsAvg() public method

Get the average of an integer type annotation.
public getAnnotationsAvg ( string $name ) : integer
$name string Annotation name
return integer

getAnnotationsMax() public method

Get the maximum of integer type annotations of a given name.
public getAnnotationsMax ( string $name ) : integer
$name string Annotation name
return integer

getAnnotationsMin() public method

Get the minimum of integer type annotations of given name.
public getAnnotationsMin ( string $name ) : integer
$name string Annotation name
return integer

getAnnotationsSum() public method

Get the sum of integer type annotations of a given name.
public getAnnotationsSum ( string $name ) : integer
$name string Annotation name
return integer

getContainerEntity() public method

Get the container entity for this object.
Since: 1.8.0
public getContainerEntity ( ) : ElggEntity
return ElggEntity

getContainerGUID() public method

Gets the container GUID for this entity.
public getContainerGUID ( ) : integer
return integer

getDisplayName() abstract public method

Get the entity's display name
abstract public getDisplayName ( ) : string
return string The title or name of this entity.

getEntitiesFromRelationship() public method

Gets an array of entities with a relationship to this entity.
See also: elgg_get_entities_from_relationship()
public getEntitiesFromRelationship ( array $options = [] ) : array | false
$options array Options array. See elgg_get_entities_from_relationship() for a list of options. 'relationship_guid' is set to this entity.
return array | false An array of entities or false on failure

getGUID() public method

Returns the guid.
public getGUID ( ) : integer | null
return integer | null GUID

getIcon() public method

Returns entity icon as an ElggIcon object The icon file may or may not exist on filestore
public getIcon ( string $size, string $type = 'icon' ) : ElggIcon
$size string Size of the icon
$type string The name of the icon. e.g., 'icon', 'cover_photo'
return ElggIcon

getIconLastChange() public method

Returns the timestamp of when the icon was changed.
public getIconLastChange ( string $size, string $type = 'icon' ) : integer | null
$size string The size of the icon
$type string The name of the icon. e.g., 'icon', 'cover_photo'
return integer | null A unix timestamp of when the icon was last changed, or null if not set.

getIconURL() public method

Plugins can register for the 'entity:icon:url', plugin hook to customize the icon for an entity.
Since: 1.8.0
public getIconURL ( mixed $params = [] ) : string
$params mixed A string defining the size of the icon (e.g. tiny, small, medium, large) or an array of parameters including 'size'
return string The URL

getLatitude() public method

Return the entity's latitude.
public getLatitude ( ) : float
return float

getLocation() public method

Gets the 'location' metadata for the entity
public getLocation ( ) : string
return string The location

getLongitude() public method

Return the entity's longitude
public getLongitude ( ) : float
return float

getMetadata() public method

Return the value of a piece of metadata.
public getMetadata ( string $name ) : mixed
$name string Name
return mixed The value, or null if not found.

getObjectFromID() public method

This is used by the system log. It can be called on any Loggable object.
public getObjectFromID ( integer $id ) : integer
$id integer GUID.
return integer GUID

getOriginalAttributes() public method

Get the original values of attribute(s) that have been modified since the entity was persisted.
public getOriginalAttributes ( ) : array
return array

getOwnerEntity() public method

Gets the \ElggEntity that owns this entity.
public getOwnerEntity ( ) : ElggEntity
return ElggEntity The owning entity

getOwnerGUID() public method

Get the guid of the entity's owner.
public getOwnerGUID ( ) : integer
return integer The owner GUID

getPrivateSetting() public method

Returns a private setting value
public getPrivateSetting ( string $name ) : mixed
$name string Name of the private setting
return mixed Null if the setting does not exist

getSubtype() public method

Get the entity subtype
public getSubtype ( ) : string
return string The entity subtype

getSystemLogID() public method

This id must be an integer.
public getSystemLogID ( ) : integer
return integer

getTags() public method

Returns tags for this entity.
public getTags ( array $tag_names = null ) : array
$tag_names array Optionally restrict by tag metadata names.
return array

getTimeUpdated() public method

Returns the UNIX epoch time that this entity was last updated
public getTimeUpdated ( ) : integer
return integer UNIX epoch time

getType() public method

Returns the entity type
public getType ( ) : string
return string The entity type

getURL() public method

Plugins can register for the 'entity:url', plugin hook to customize the url for an entity.
public getURL ( ) : string
return string The URL of the entity

getVolatileData() public method

Get a piece of volatile (non-persisted) data on this entity.
public getVolatileData ( string $name ) : mixed
$name string The name of the volatile data
return mixed The value or null if not found.

hasIcon() public method

Returns if the entity has an icon of the passed type.
public hasIcon ( string $size, string $type = 'icon' ) : boolean
$size string The size of the icon
$type string The name of the icon. e.g., 'icon', 'cover_photo'
return boolean

initializeAttributes() protected method

This is vital to distinguish between metadata and base parameters.
protected initializeAttributes ( ) : void
return void

isEnabled() public method

Is this entity enabled?
public isEnabled ( ) : boolean
return boolean Whether this entity is enabled.

isFullyLoaded() public method

Tests to see whether the object has been persisted.
public isFullyLoaded ( ) : boolean
return boolean

load() protected method

Loads attributes from the entities table into the object.
protected load ( mixed $guid ) : boolean
$guid mixed GUID of entity or \stdClass object from entities table
return boolean

loadAdditionalSelectValues() protected method

Stores non-attributes from the loading of the entity as volatile data
protected loadAdditionalSelectValues ( array $data ) : void
$data array Key value array
return void

prepareObject() protected method

Prepare an object copy for toObject()
protected prepareObject ( stdClass $object ) : stdClass
$object stdClass Object representation of the entity
return stdClass

refresh() public method

Load new data from database into existing entity. Overwrites data but does not change values not included in the latest data.
public refresh ( stdClass $row ) : boolean
$row stdClass DB row with new entity data
return boolean

removePrivateSetting() public method

Removes private setting
public removePrivateSetting ( string $name ) : boolean
$name string Name of the private setting
return boolean

removeRelationship() public method

Remove a relationship
See also: ElggEntity::addRelationship()
See also: ElggEntity::deleteRelationships()
public removeRelationship ( integer $guid_two, string $relationship ) : boolean
$guid_two integer GUID of the target entity of the relationship.
$relationship string The type of relationship.
return boolean

save() public method

Save an entity.
public save ( ) : boolean | integer
return boolean | integer

saveIconFromElggFile() public method

Saves icons using a file located in the data store as the source.
public saveIconFromElggFile ( ElggFile $file, string $type = 'icon', array $coords = [] ) : boolean
$file ElggFile An ElggFile instance
$type string The name of the icon. e.g., 'icon', 'cover_photo'
$coords array An array of cropping coordinates x1, y1, x2, y2
return boolean

saveIconFromLocalFile() public method

Saves icons using a local file as the source.
public saveIconFromLocalFile ( string $filename, string $type = 'icon', array $coords = [] ) : boolean
$filename string The full path to the local file
$type string The name of the icon. e.g., 'icon', 'cover_photo'
$coords array An array of cropping coordinates x1, y1, x2, y2
return boolean

saveIconFromUploadedFile() public method

Saves icons using an uploaded file as the source.
public saveIconFromUploadedFile ( string $input_name, string $type = 'icon', array $coords = [] ) : boolean
$input_name string Form input name
$type string The name of the icon. e.g., 'icon', 'cover_photo'
$coords array An array of cropping coordinates x1, y1, x2, y2
return boolean

setContainerGUID() public method

Set the container for this object.
public setContainerGUID ( integer $container_guid ) : boolean
$container_guid integer The ID of the container.
return boolean

setDisplayName() abstract public method

Sets the title or name of this entity.
abstract public setDisplayName ( string $displayName ) : void
$displayName string The title or name of this entity.
return void

setLatLong() public method

Set latitude and longitude metadata tags for a given entity.
public setLatLong ( float $lat, float $long ) : void
$lat float Latitude
$long float Longitude
return void

setLocation() public method

Sets the 'location' metadata for the entity
public setLocation ( string $location ) : void
$location string String representation of the location
return void

setMetadata() public method

Plugin developers usually want to use the magic set method ($entity->name = 'value'). Use this method if you want to explicitly set the owner or access of the metadata. You cannot set the owner/access before the entity has been saved.
public setMetadata ( string $name, mixed $value, string $value_type = '', boolean $multiple = false, integer $owner_guid, integer $access_id = null ) : boolean
$name string Name of the metadata
$value mixed Value of the metadata (doesn't support assoc arrays)
$value_type string 'text', 'integer', or '' for automatic detection
$multiple boolean Allow multiple values for a single name. Does not support associative arrays.
$owner_guid integer GUID of entity that owns the metadata. Default is owner of entity.
$access_id integer Who can read the metadata relative to the owner (deprecated). Default is the access level of the entity. Use ACCESS_PUBLIC for compatibility with Elgg 3.0
return boolean

setPrivateSetting() public method

Private settings are similar to metadata but will not be searched and there are fewer helper functions for them.
public setPrivateSetting ( string $name, mixed $value ) : boolean
$name string Name of private setting
$value mixed Value of private setting
return boolean

setVolatileData() public method

Set a piece of volatile (non-persisted) data on this entity
public setVolatileData ( string $name, mixed $value ) : void
$name string Name
$value mixed Value
return void

storeInPersistedCache() public method

Cache the entity in a persisted cache
public storeInPersistedCache ( ElggSharedMemoryCache $cache, integer $last_action ) : void
$cache ElggSharedMemoryCache Memcache or null cache
$last_action integer Last action time
return void

toObject() public method

public toObject ( )

update() protected method

Update the entity in the database.
protected update ( ) : boolean
return boolean Whether the update was successful.

updateLastAction() public method

Update the last_action column in the entities table.
public updateLastAction ( integer $posted = null ) : integer | false
$posted integer Timestamp of last action
return integer | false

Property Details

$orig_attributes protected property

Holds the original (persisted) attribute values that have been changed but not yet saved.
protected $orig_attributes

$temp_annotations protected property

Holds annotations until entity is saved. Once the entity is saved, annotations are written immediately to the database.
protected $temp_annotations

$temp_metadata protected property

Holds metadata until entity is saved. Once the entity is saved, metadata are written immediately to the database.
protected $temp_metadata

$temp_private_settings protected property

Holds private settings until entity is saved. Once the entity is saved, private settings are written immediately to the database.
protected $temp_private_settings

$url_override protected property

If set, overrides the value of getURL()
protected $url_override

$volatile protected property

Volatile data structure for this object, allows for storage of data in-memory that isn't sync'd back to the metadata table.
protected $volatile