PHP Class ElggEntity, Elgg

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

Protected Properties

Свойство 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.

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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

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

Method Details

__clone() public méthode

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
Résultat void

__get() public méthode

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
Résultat mixed

__set() public méthode

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
Résultat void

__unset() public méthode

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

addRelationship() public méthode

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.
Résultat boolean

annotate() public méthode

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
Résultat boolean | integer Returns int if an annotation is saved

canAnnotate() public méthode

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)
Résultat boolean

canComment() public méthode

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
Résultat boolean

canDelete() public méthode

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)
Résultat boolean Whether this entity is deletable by the given user.

canEdit() public méthode

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)
Résultat boolean Whether this entity is editable by the given user.

canEditMetadata() public méthode

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)
Résultat boolean

canWriteToContainer() public méthode

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
Résultat boolean

countAnnotations() public méthode

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

countComments() public méthode

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

countEntitiesFromRelationship() public méthode

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
Résultat integer | false The number of entities or false on failure

create() protected méthode

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
Résultat integer The new entity's GUID

delete() public méthode

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.
Résultat boolean

deleteAccessCollectionMemberships() public méthode

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

deleteAnnotations() public méthode

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.
Résultat boolean

deleteIcon() public méthode

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'
Résultat boolean

deleteMetadata() public méthode

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.
Résultat boolean

deleteOwnedAccessCollections() public méthode

Remove all access collections owned by this entity
Since: 1.11

deleteOwnedAnnotations() public méthode

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.
Résultat boolean

deleteOwnedMetadata() public méthode

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.
Résultat boolean

deleteRelationships() public méthode

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.
Résultat boolean

disable() public méthode

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?
Résultat boolean

disableAnnotations() public méthode

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.
Résultat boolean

disableMetadata() public méthode

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.
Résultat boolean

enable() public méthode

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?
Résultat boolean

enableAnnotations() public méthode

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.
Résultat boolean

enableMetadata() public méthode

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.
Résultat boolean

getAccessID() public méthode

Returns the access_id.
public getAccessID ( ) : integer
Résultat integer The access ID

getAnnotations() public méthode

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.
Résultat array

getAnnotationsAvg() public méthode

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

getAnnotationsMax() public méthode

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

getAnnotationsMin() public méthode

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

getAnnotationsSum() public méthode

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

getContainerEntity() public méthode

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

getContainerGUID() public méthode

Gets the container GUID for this entity.
public getContainerGUID ( ) : integer
Résultat integer

getDisplayName() abstract public méthode

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

getEntitiesFromRelationship() public méthode

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.
Résultat array | false An array of entities or false on failure

getGUID() public méthode

Returns the guid.
public getGUID ( ) : integer | null
Résultat integer | null GUID

getIcon() public méthode

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'
Résultat ElggIcon

getIconLastChange() public méthode

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'
Résultat integer | null A unix timestamp of when the icon was last changed, or null if not set.

getIconURL() public méthode

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'
Résultat string The URL

getLatitude() public méthode

Return the entity's latitude.
public getLatitude ( ) : float
Résultat float

getLocation() public méthode

Gets the 'location' metadata for the entity
public getLocation ( ) : string
Résultat string The location

getLongitude() public méthode

Return the entity's longitude
public getLongitude ( ) : float
Résultat float

getMetadata() public méthode

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

getObjectFromID() public méthode

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

getOriginalAttributes() public méthode

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

getOwnerEntity() public méthode

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

getOwnerGUID() public méthode

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

getPrivateSetting() public méthode

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

getSubtype() public méthode

Get the entity subtype
public getSubtype ( ) : string
Résultat string The entity subtype

getSystemLogID() public méthode

This id must be an integer.
public getSystemLogID ( ) : integer
Résultat integer

getTags() public méthode

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

getTimeUpdated() public méthode

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

getType() public méthode

Returns the entity type
public getType ( ) : string
Résultat string The entity type

getURL() public méthode

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

getVolatileData() public méthode

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

hasIcon() public méthode

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'
Résultat boolean

initializeAttributes() protected méthode

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

isEnabled() public méthode

Is this entity enabled?
public isEnabled ( ) : boolean
Résultat boolean Whether this entity is enabled.

isFullyLoaded() public méthode

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

load() protected méthode

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
Résultat boolean

loadAdditionalSelectValues() protected méthode

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

prepareObject() protected méthode

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

refresh() public méthode

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
Résultat boolean

removePrivateSetting() public méthode

Removes private setting
public removePrivateSetting ( string $name ) : boolean
$name string Name of the private setting
Résultat boolean

removeRelationship() public méthode

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.
Résultat boolean

save() public méthode

Save an entity.
public save ( ) : boolean | integer
Résultat boolean | integer

saveIconFromElggFile() public méthode

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
Résultat boolean

saveIconFromLocalFile() public méthode

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
Résultat boolean

saveIconFromUploadedFile() public méthode

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
Résultat boolean

setContainerGUID() public méthode

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

setDisplayName() abstract public méthode

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

setLatLong() public méthode

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

setLocation() public méthode

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

setMetadata() public méthode

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
Résultat boolean

setPrivateSetting() public méthode

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
Résultat boolean

setVolatileData() public méthode

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

storeInPersistedCache() public méthode

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
Résultat void

toObject() public méthode

public toObject ( )

update() protected méthode

Update the entity in the database.
protected update ( ) : boolean
Résultat boolean Whether the update was successful.

updateLastAction() public méthode

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

Property Details

$orig_attributes protected_oe property

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

$temp_annotations protected_oe 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_oe 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_oe 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_oe property

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

$volatile protected_oe 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