Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ElggEntity Class Reference
Inheritance diagram for ElggEntity:
ElggData Locatable Importable Elgg\EntityIcon Loggable Exportable ElggGroup ElggObject ElggSite ElggUser ElggComment ElggFile ElggPlugin ElggUpgrade ElggWidget ElggIcon

Public Member Functions

 __clone ()
 Clone an entity. More...
 
 __set ($name, $value)
 Set an attribute or metadata value for this entity. More...
 
 set ($name, $value)
 Sets the value of an attribute or metadata. More...
 
 getOriginalAttributes ()
 Get the original values of attribute(s) that have been modified since the entity was persisted. More...
 
 __get ($name)
 Get an attribute or metadata value. More...
 
 get ($name)
 Return the value of an attribute or metadata. More...
 
 getDisplayName ()
 Get the entity's display name. More...
 
 setDisplayName ($displayName)
 Sets the title or name of this entity. More...
 
 getMetadata ($name)
 Return the value of a piece of metadata. More...
 
 __unset ($name)
 Unset a property from metadata or attribute. More...
 
 setMetadata ($name, $value, $value_type= '', $multiple=false, $owner_guid=0, $access_id=null)
 Set metadata on this entity. More...
 
 deleteMetadata ($name=null)
 Deletes all metadata on this object (metadata.entity_guid = $this->guid). More...
 
 deleteOwnedMetadata ($name=null)
 Deletes all metadata owned by this object (metadata.owner_guid = $this->guid). More...
 
 disableMetadata ($name= '')
 Disables metadata for this entity, optionally based on name. More...
 
 enableMetadata ($name= '')
 Enables metadata for this entity, optionally based on name. More...
 
 getVolatileData ($name)
 Get a piece of volatile (non-persisted) data on this entity. More...
 
 setVolatileData ($name, $value)
 Set a piece of volatile (non-persisted) data on this entity. More...
 
 deleteRelationships ($relationship=null)
 Remove all relationships to and from this entity. More...
 
 addRelationship ($guid_two, $relationship)
 Add a relationship between this an another entity. More...
 
 removeRelationship ($guid_two, $relationship)
 Remove a relationship. More...
 
 setPrivateSetting ($name, $value)
 Adds a private setting to this entity. More...
 
 getPrivateSetting ($name)
 Returns a private setting value. More...
 
 removePrivateSetting ($name)
 Removes private setting. More...
 
 deleteAnnotations ($name=null)
 Deletes all annotations on this object (annotations.entity_guid = $this->guid). More...
 
 deleteOwnedAnnotations ($name=null)
 Deletes all annotations owned by this object (annotations.owner_guid = $this->guid). More...
 
 disableAnnotations ($name= '')
 Disables annotations for this entity, optionally based on name. More...
 
 enableAnnotations ($name= '')
 Enables annotations for this entity, optionally based on name. More...
 
 annotate ($name, $value, $access_id=ACCESS_PRIVATE, $owner_guid=0, $vartype="")
 Adds an annotation to an entity. More...
 
 getAnnotations ($options=array(), $limit=50, $offset=0, $order="asc")
 Gets an array of annotations. More...
 
 countAnnotations ($name="")
 Count annotations. More...
 
 getAnnotationsAvg ($name)
 Get the average of an integer type annotation. More...
 
 getAnnotationsSum ($name)
 Get the sum of integer type annotations of a given name. More...
 
 getAnnotationsMin ($name)
 Get the minimum of integer type annotations of given name. More...
 
 getAnnotationsMax ($name)
 Get the maximum of integer type annotations of a given name. More...
 
 countComments ()
 Count the number of comments attached to this entity. More...
 
 getEntitiesFromRelationship ($options=array(), $inverse=false, $limit=50, $offset=0)
 Gets an array of entities with a relationship to this entity. More...
 
 countEntitiesFromRelationship ($relationship, $inverse_relationship=false)
 Gets the number of entities from a specific relationship type. More...
 
 canEdit ($user_guid=0)
 Can a user edit this entity? More...
 
 canDelete ($user_guid=0)
 Can a user delete this entity? More...
 
 canEditMetadata ($metadata=null, $user_guid=0)
 Can a user edit metadata on this entity? More...
 
 canWriteToContainer ($user_guid=0, $type= 'all', $subtype= 'all')
 Can a user add an entity to this container. More...
 
 canComment ($user_guid=0)
 Can a user comment on an entity? More...
 
 canAnnotate ($user_guid=0, $annotation_name= '')
 Can a user annotate an entity? More...
 
 getAccessID ()
 Returns the access_id. More...
 
 getGUID ()
 Returns the guid. More...
 
 getType ()
 Returns the entity type. More...
 
 getSubtype ()
 Get the entity subtype. More...
 
 getOwnerGUID ()
 Get the guid of the entity's owner. More...
 
 getOwnerEntity ()
 Gets the that owns this entity. More...
 
 setContainerGUID ($container_guid)
 Set the container for this object. More...
 
 getContainerGUID ()
 Gets the container GUID for this entity. More...
 
 getContainerEntity ()
 Get the container entity for this object. More...
 
 getTimeUpdated ()
 Returns the UNIX epoch time that this entity was last updated. More...
 
 getURL ()
 Gets the URL for this entity. More...
 
 setURL ($url)
 Overrides the URL returned by getURL() More...
 
 saveIconFromUploadedFile ($input_name, $type= 'icon', array $coords=array())
 Saves icons using an uploaded file as the source. More...
 
 saveIconFromLocalFile ($filename, $type= 'icon', array $coords=array())
 Saves icons using a local file as the source. More...
 
 saveIconFromElggFile (\ElggFile $file, $type= 'icon', array $coords=array())
 Saves icons using a file located in the data store as the source. More...
 
 getIcon ($size, $type= 'icon')
 Returns entity icon as an ElggIcon object The icon file may or may not exist on filestore. More...
 
 deleteIcon ($type= 'icon')
 Removes all icon files and metadata for the passed type of icon. More...
 
 getIconLastChange ($size, $type= 'icon')
 Returns the timestamp of when the icon was changed. More...
 
 hasIcon ($size, $type= 'icon')
 Returns if the entity has an icon of the passed type. More...
 
 getIconURL ($params=array())
 Get the URL for this entity's icon. More...
 
 addToSite ($site)
 Add this entity to a site. More...
 
 removeFromSite ($site)
 Remove this entity from a site. More...
 
 getSites ($options=array())
 Gets the sites this entity is a member of. More...
 
 isFullyLoaded ()
 Tests to see whether the object has been persisted. More...
 
 save ()
 Save an entity. More...
 
 refresh (\stdClass $row)
 Load new data from database into existing entity. More...
 
 disable ($reason="", $recursive=true)
 Disable this entity. More...
 
 enable ($recursive=true)
 Enable the entity. More...
 
 isEnabled ()
 Is this entity enabled? More...
 
 delete ($recursive=true)
 Deletes the entity. More...
 
 toObject ()
 {} More...
 
 getLocation ()
 Gets the 'location' metadata for the entity. More...
 
 setLocation ($location)
 Sets the 'location' metadata for the entity. More...
 
 setLatLong ($lat, $long)
 Set latitude and longitude metadata tags for a given entity. More...
 
 getLatitude ()
 Return the entity's latitude. More...
 
 getLongitude ()
 Return the entity's longitude. More...
 
 getExportableValues ()
 Returns an array of fields which can be exported. More...
 
 export ()
 Export this class into an array of ODD Elements containing all necessary fields. More...
 
 import (ODD $data)
 Import data from an parsed ODD xml data array. More...
 
 getSystemLogID ()
 Return an identification for the object for storage in the system log. More...
 
 getObjectFromID ($id)
 For a given ID, return the object associated with it. More...
 
 getTags ($tag_names=null)
 Returns tags for this entity. More...
 
 deleteAccessCollectionMemberships ()
 Remove the membership of all access collections for this entity (if the entity is a user) More...
 
 deleteOwnedAccessCollections ()
 Remove all access collections owned by this entity. More...
 
- Public Member Functions inherited from ElggData
 __isset ($name)
 Test if property is set either as an attribute or metadata. More...
 
 getURL ()
 Get a URL for this object. More...
 
 save ()
 Save this data to the appropriate database table. More...
 
 delete ()
 Delete this data. More...
 
 getTimeCreated ()
 Returns the UNIX epoch time that this entity was created. More...
 
 toObject ()
 Get a plain old object copy for public consumption. More...
 
 getClassName ()
 Return the class name of the object. More...
 
 rewind ()
 Iterator interface. More...
 
 current ()
 Iterator interface. More...
 
 key ()
 Iterator interface. More...
 
 next ()
 Iterator interface. More...
 
 valid ()
 Iterator interface. More...
 
 offsetSet ($key, $value)
 Array access interface. More...
 
 offsetGet ($key)
 Array access interface. More...
 
 offsetUnset ($key)
 Array access interface. More...
 
 offsetExists ($offset)
 Array access interface. More...
 

Protected Member Functions

 initializeAttributes ()
 Initialize the attributes array. More...
 
 create ()
 Create a new entry in the entities table. More...
 
 update ()
 Update the entity in the database. More...
 
 load ($guid)
 Loads attributes from the entities table into the object. More...
 
 loadAdditionalSelectValues (array $data)
 Stores non-attributes from the loading of the entity as volatile data. More...
 
 prepareObject ($object)
 Prepare an object copy for toObject() More...
 
- Protected Member Functions inherited from ElggData
 initializeAttributes ()
 Initialize the attributes array. More...
 
 getDatabase ()
 Provides a pointer to the database object. More...
 
 get ($name)
 Fetch the specified attribute. More...
 
 set ($name, $value)
 Set the specified attribute. More...
 

Protected Attributes

 $url_override
 If set, overrides the value of getURL() More...
 
 $temp_metadata = array()
 Holds metadata until entity is saved. More...
 
 $temp_annotations = array()
 Holds annotations until entity is saved. More...
 
 $temp_private_settings = array()
 Holds private settings until entity is saved. More...
 
 $volatile = array()
 Volatile data structure for this object, allows for storage of data in-memory that isn't sync'd back to the metadata table. More...
 
 $orig_attributes = array()
 Holds the original (persisted) attribute values that have been changed but not yet saved. More...
 
- Protected Attributes inherited from ElggData
 $attributes = array()
 The main attributes of an entity. More...
 
 $valid = false
 

Detailed Description

Definition at line 42 of file ElggEntity.php.

Member Function Documentation

ElggEntity::__clone ( )

Clone an entity.

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.

Note
metadata will have its owner and access id set when the entity is saved and it will be the same as that of the entity.
Returns
void

Definition at line 119 of file ElggEntity.php.

ElggEntity::__get (   $name)

Get an attribute or metadata value.

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.

Parameters
string$nameName of the attribute or metadata
Returns
mixed

Definition at line 262 of file ElggEntity.php.

ElggEntity::__set (   $name,
  $value 
)

Set an attribute or metadata value for this entity.

Anything that is not an attribute is saved as metadata.

Warning
Metadata set this way will inherit the entity's owner and access ID. If you want more control over metadata, use ::setMetadata()
Parameters
string$nameName of the attribute or metadata
mixed$valueThe value to be set
Returns
void
See Also
::setMetadata()

Definition at line 166 of file ElggEntity.php.

ElggEntity::__unset (   $name)

Unset a property from metadata or attribute.

Warning
If you use this to unset an attribute, you must save the object!
Parameters
string$nameThe name of the attribute or metadata.
Returns
void

Definition at line 372 of file ElggEntity.php.

ElggEntity::addRelationship (   $guid_two,
  $relationship 
)

Add a relationship between this an another entity.

Read the relationship like "This entity is a $relationship of $guid_two."

Parameters
int$guid_twoGUID of the target entity of the relationship.
string$relationshipThe type of relationship.
Returns
bool
See Also
::removeRelationship()
::deleteRelationships()

Definition at line 627 of file ElggEntity.php.

ElggEntity::addToSite (   $site)

Add this entity to a site.

This creates a 'member_of_site' relationship.

Parameters
\ElggSite$siteThe site to add this entity to
Returns
bool

Definition at line 1363 of file ElggEntity.php.

ElggEntity::annotate (   $name,
  $value,
  $access_id = ACCESS_PRIVATE,
  $owner_guid = 0,
  $vartype = "" 
)

Adds an annotation to an entity.

Warning
By default, annotations are private.
Annotating an unsaved entity more than once with the same name will only save the last annotation.
Parameters
string$nameAnnotation name
mixed$valueAnnotation value
int$access_idAccess ID
int$owner_guidGUID of the annotation owner
string$vartypeThe type of annotation value
Returns
bool|int Returns int if an annotation is saved

Definition at line 815 of file ElggEntity.php.

ElggEntity::canAnnotate (   $user_guid = 0,
  $annotation_name = '' 
)

Can a user annotate an entity?

Can be overridden by registering for the plugin hook [permissions_check:annotate:<name>, <entity type>="">] or [permissions_check:annotate, <entity type>="">]. The hooks are called in that order.

If you want logged out users to annotate an object, do not call canAnnotate(). It's easier than using the plugin hook.

Parameters
int$user_guidUser guid (default is logged in user)
string$annotation_nameThe name of the annotation (default is unspecified)
Returns
bool

Definition at line 1090 of file ElggEntity.php.

ElggEntity::canComment (   $user_guid = 0)

Can a user comment on an entity?

Can be overridden by registering for the permissions_check:comment, <entity type>=""> plugin hook.

Parameters
int$user_guidUser guid (default is logged in user)
Returns
bool

Definition at line 1072 of file ElggEntity.php.

ElggEntity::canDelete (   $user_guid = 0)

Can a user delete this entity?

Can be overridden by registering for the permissions_check:delete plugin hook.

Parameters
int$user_guidThe user GUID, optionally (default: logged in user)
Returns
bool Whether this entity is deletable by the given user.
Since
1.11
See Also
elgg_set_ignore_access()

Definition at line 1025 of file ElggEntity.php.

ElggEntity::canEdit (   $user_guid = 0)

Can a user edit this entity?

Can be overridden by registering for the permissions_check plugin hook.

Parameters
int$user_guidThe user GUID, optionally (default: logged in user)
Returns
bool Whether this entity is editable by the given user.
See Also
elgg_set_ignore_access()

Definition at line 1010 of file ElggEntity.php.

ElggEntity::canEditMetadata (   $metadata = null,
  $user_guid = 0 
)

Can a user edit metadata on this entity?

If no specific metadata is passed, it returns whether the user can edit any metadata on the entity.

Can be overridden by by registering for the permissions_check:metadata plugin hook.

Parameters
\ElggMetadata$metadataThe piece of metadata to specifically check or null for any metadata
int$user_guidThe user GUID, optionally (default: logged in user)
Returns
bool
See Also
elgg_set_ignore_access()

Definition at line 1044 of file ElggEntity.php.

ElggEntity::canWriteToContainer (   $user_guid = 0,
  $type = 'all',
  $subtype = 'all' 
)

Can a user add an entity to this container.

Parameters
int$user_guidThe GUID of the user creating the entity (0 for logged in user).
string$typeThe type of entity we're looking to write
string$subtypeThe subtype of the entity we're looking to write
Returns
bool
See Also
elgg_set_ignore_access()

Definition at line 1058 of file ElggEntity.php.

ElggEntity::countAnnotations (   $name = "")

Count annotations.

Parameters
string$nameThe type of annotation.
Returns
int

Definition at line 883 of file ElggEntity.php.

ElggEntity::countComments ( )

Count the number of comments attached to this entity.

Returns
int Number of comments
Since
1.8.0

Definition at line 937 of file ElggEntity.php.

ElggEntity::countEntitiesFromRelationship (   $relationship,
  $inverse_relationship = false 
)

Gets the number of entities from a specific relationship type.

Parameters
string$relationshipRelationship type (eg "friends")
bool$inverse_relationshipInvert relationship
Returns
int|false The number of entities or false on failure

Definition at line 991 of file ElggEntity.php.

ElggEntity::create ( )
protected

Create a new entry in the entities table.

Saves the base information in the entities table for the entity. Saving the type-specific information is handled in the calling class method.

Warning
Entities must have an entry in both the entities table and their type table or they will throw an exception when loaded.
Returns
int The new entity's GUID
Exceptions
InvalidParameterExceptionIf the entity's type has not been set.
IOExceptionIf the new row fails to write to the DB.

Definition at line 1462 of file ElggEntity.php.

ElggEntity::delete (   $recursive = true)

Deletes the entity.

Removes the entity and its metadata, annotations, relationships, river entries, and private data.

Optionally can remove entities contained and owned by this entity.

Warning
If deleting recursively, this bypasses ownership of items contained by the entity. That means that if the container_guid = $this->guid, the item will be deleted regardless of who owns it.
Parameters
bool$recursiveIf true (default) then all entities which are owned or contained by $this will also be deleted.
Returns
bool

Definition at line 1916 of file ElggEntity.php.

ElggEntity::deleteAccessCollectionMemberships ( )

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

Returns
bool
Since
1.11

Definition at line 2322 of file ElggEntity.php.

ElggEntity::deleteAnnotations (   $name = null)

Deletes all annotations on this object (annotations.entity_guid = $this->guid).

If you pass a name, only annotations matching that name will be deleted.

Warning
Calling this with no or empty arguments will clear all annotations on the entity.
Parameters
null | string$nameThe annotations name to remove.
Returns
bool
Since
1.8

Definition at line 704 of file ElggEntity.php.

ElggEntity::deleteIcon (   $type = 'icon')

Removes all icon files and metadata for the passed type of icon.

Parameters
string$typeThe name of the icon. e.g., 'icon', 'cover_photo'
Returns
bool

Implements Elgg\EntityIcon.

Definition at line 1310 of file ElggEntity.php.

ElggEntity::deleteMetadata (   $name = null)

Deletes all metadata on this object (metadata.entity_guid = $this->guid).

If you pass a name, only metadata matching that name will be deleted.

Warning
Calling this with no $name will clear all metadata on the entity.
Parameters
null | string$nameThe name of the metadata to remove.
Returns
bool
Since
1.8

Definition at line 479 of file ElggEntity.php.

ElggEntity::deleteOwnedAccessCollections ( )

Remove all access collections owned by this entity.

Returns
bool
Since
1.11

Definition at line 2353 of file ElggEntity.php.

ElggEntity::deleteOwnedAnnotations (   $name = null)

Deletes all annotations owned by this object (annotations.owner_guid = $this->guid).

If you pass a name, only annotations matching that name will be deleted.

Parameters
null | string$nameThe name of annotations to delete.
Returns
bool
Since
1.8

Definition at line 724 of file ElggEntity.php.

ElggEntity::deleteOwnedMetadata (   $name = null)

Deletes all metadata owned by this object (metadata.owner_guid = $this->guid).

If you pass a name, only metadata matching that name will be deleted.

Parameters
null | string$nameThe name of metadata to delete.
Returns
bool
Since
1.8

Definition at line 504 of file ElggEntity.php.

ElggEntity::deleteRelationships (   $relationship = null)

Remove all relationships to and from this entity.

If you pass a relationship name, only relationships matching that name will be deleted.

Warning
Calling this with no $relationship will clear all relationships for this entity.
Parameters
null | string$relationshipThe name of the relationship to remove.
Returns
bool
See Also
::addRelationship()
::removeRelationship()

Definition at line 609 of file ElggEntity.php.

ElggEntity::disable (   $reason = "",
  $recursive = true 
)

Disable this entity.

Disabled entities are not returned by getter functions. To enable an entity, use ElggEntity::enable().Recursivelydisablinganentitywilldisableallentitiesownedorcontainedbytheparententity.Youcanignorethedisabledfieldbyusing@linkaccess_show_hidden_entities().@noteInternal:Disablinganentitysetsthe'enabled'columnto'no'.@paramstring$reasonOptionalreason@parambool$recursiveRecursivelydisableallcontainedentities?@returnbool@see\ElggEntity::enable()

Definition at line 1748 of file ElggEntity.php.

ElggEntity::disableAnnotations (   $name = '')

Disables annotations for this entity, optionally based on name.

Parameters
string$nameAn options name of annotations to disable.
Returns
bool
Since
1.8

Definition at line 748 of file ElggEntity.php.

ElggEntity::disableMetadata (   $name = '')

Disables metadata for this entity, optionally based on name.

Parameters
string$nameAn options name of metadata to disable.
Returns
bool
Since
1.8

Definition at line 528 of file ElggEntity.php.

ElggEntity::enable (   $recursive = true)

Enable the entity.

Warning
Disabled entities can't be loaded unless access_show_hidden_entities(true) has been called.
Parameters
bool$recursiveRecursively enable all entities disabled with the entity?
See Also
access_show_hiden_entities()
Returns
bool

Definition at line 1838 of file ElggEntity.php.

ElggEntity::enableAnnotations (   $name = '')

Enables annotations for this entity, optionally based on name.

Warning
Before calling this, you must use access_show_hidden_entities()
Parameters
string$nameAn options name of annotations to enable.
Returns
bool
Since
1.8

Definition at line 769 of file ElggEntity.php.

ElggEntity::enableMetadata (   $name = '')

Enables metadata for this entity, optionally based on name.

Warning
Before calling this, you must use access_show_hidden_entities()
Parameters
string$nameAn options name of metadata to enable.
Returns
bool
Since
1.8

Definition at line 549 of file ElggEntity.php.

ElggEntity::export ( )

Export this class into an array of ODD Elements containing all necessary fields.

Override if you wish to return more information than can be found in $this->attributes (shouldn't happen)

Returns
array

Implements Exportable.

Definition at line 2143 of file ElggEntity.php.

ElggEntity::get (   $name)

Return the value of an attribute or metadata.

Parameters
string$nameName
Returns
mixed Returns the value of a given value, or null.

Definition at line 286 of file ElggEntity.php.

ElggEntity::getAccessID ( )

Returns the access_id.

Returns
int The access ID

Definition at line 1099 of file ElggEntity.php.

ElggEntity::getAnnotations (   $options = array(),
  $limit = 50,
  $offset = 0,
  $order = "asc" 
)

Gets an array of annotations.

To retrieve annotations on an unsaved entity, pass array('name' => [annotation name]) as the options array.

Parameters
array$optionsArray of options for elgg_get_annotations() except guid. This may be passed a string annotation name, but this usage is deprecated.
int$limitLimit (deprecated)
int$offsetOffset (deprecated)
string$orderOrder by time: asc or desc (deprecated)
Returns
array
See Also
elgg_get_annotations()

Definition at line 839 of file ElggEntity.php.

ElggEntity::getAnnotationsAvg (   $name)

Get the average of an integer type annotation.

Parameters
string$nameAnnotation name
Returns
int

Definition at line 894 of file ElggEntity.php.

ElggEntity::getAnnotationsMax (   $name)

Get the maximum of integer type annotations of a given name.

Parameters
string$nameAnnotation name
Returns
int

Definition at line 927 of file ElggEntity.php.

ElggEntity::getAnnotationsMin (   $name)

Get the minimum of integer type annotations of given name.

Parameters
string$nameAnnotation name
Returns
int

Definition at line 916 of file ElggEntity.php.

ElggEntity::getAnnotationsSum (   $name)

Get the sum of integer type annotations of a given name.

Parameters
string$nameAnnotation name
Returns
int

Definition at line 905 of file ElggEntity.php.

ElggEntity::getContainerEntity ( )

Get the container entity for this object.

Returns
Since
1.8.0

Definition at line 1178 of file ElggEntity.php.

ElggEntity::getContainerGUID ( )

Gets the container GUID for this entity.

Returns
int

Definition at line 1168 of file ElggEntity.php.

ElggEntity::getDisplayName ( )
abstract

Get the entity's display name.

Returns
string The title or name of this entity.
ElggEntity::getEntitiesFromRelationship (   $options = array(),
  $inverse = false,
  $limit = 50,
  $offset = 0 
)

Gets an array of entities with a relationship to this entity.

Parameters
array$optionsOptions array. See elgg_get_entities_from_relationship() for a list of options. 'relationship_guid' is set to this entity.
bool$inverseIs this an inverse relationship? (deprecated)
int$limitNumber of elements to return (deprecated)
int$offsetIndexing offset (deprecated)
Returns
array|false An array of entities or false on failure
See Also
elgg_get_entities_from_relationship()

Definition at line 967 of file ElggEntity.php.

ElggEntity::getExportableValues ( )

Returns an array of fields which can be exported.

Returns
array

Implements Exportable.

Definition at line 2121 of file ElggEntity.php.

ElggEntity::getGUID ( )

Returns the guid.

Returns
int|null GUID

Definition at line 1108 of file ElggEntity.php.

ElggEntity::getIcon (   $size,
  $type = 'icon' 
)

Returns entity icon as an ElggIcon object The icon file may or may not exist on filestore.

Parameters
string$sizeSize of the icon
string$typeThe name of the icon. e.g., 'icon', 'cover_photo'
Returns

Implements Elgg\EntityIcon.

Definition at line 1300 of file ElggEntity.php.

ElggEntity::getIconLastChange (   $size,
  $type = 'icon' 
)

Returns the timestamp of when the icon was changed.

Parameters
string$sizeThe size of the icon
string$typeThe name of the icon. e.g., 'icon', 'cover_photo'
Returns
int|null A unix timestamp of when the icon was last changed, or null if not set.

Implements Elgg\EntityIcon.

Definition at line 1322 of file ElggEntity.php.

ElggEntity::getIconURL (   $params = array())

Get the URL for this entity's icon.

Plugins can register for the 'entity:icon:url', <type> plugin hook to customize the icon for an entity.

Parameters
mixed$paramsA string defining the size of the icon (e.g. tiny, small, medium, large) or an array of parameters including 'size'
Returns
string The URL
Since
1.8.0

Implements Elgg\EntityIcon.

Definition at line 1348 of file ElggEntity.php.

ElggEntity::getLatitude ( )

Return the entity's latitude.

Returns
float

Implements Locatable.

Definition at line 2097 of file ElggEntity.php.

ElggEntity::getLocation ( )

Gets the 'location' metadata for the entity.

Returns
string The location

Implements Locatable.

Definition at line 2062 of file ElggEntity.php.

ElggEntity::getLongitude ( )

Return the entity's longitude.

Returns
float

Implements Locatable.

Definition at line 2107 of file ElggEntity.php.

ElggEntity::getMetadata (   $name)

Return the value of a piece of metadata.

Parameters
string$nameName
Returns
mixed The value, or null if not found.

Definition at line 313 of file ElggEntity.php.

ElggEntity::getObjectFromID (   $id)

For a given ID, return the object associated with it.

This is used by the system log. It can be called on any Loggable object.

Parameters
int$idGUID.
Returns
int GUID

Implements Loggable.

Definition at line 2276 of file ElggEntity.php.

ElggEntity::getOriginalAttributes ( )

Get the original values of attribute(s) that have been modified since the entity was persisted.

Returns
array

Definition at line 246 of file ElggEntity.php.

ElggEntity::getOwnerEntity ( )

Gets the that owns this entity.

Returns
The owning entity

Definition at line 1148 of file ElggEntity.php.

ElggEntity::getOwnerGUID ( )

Get the guid of the entity's owner.

Returns
int The owner GUID

Definition at line 1139 of file ElggEntity.php.

ElggEntity::getPrivateSetting (   $name)

Returns a private setting value.

Parameters
string$nameName of the private setting
Returns
mixed Null if the setting does not exist

Definition at line 672 of file ElggEntity.php.

ElggEntity::getSites (   $options = array())

Gets the sites this entity is a member of.

Site membership is determined by relationships and not site_guid.

Parameters
array$optionsOptions array for elgg_get_entities_from_relationship() Parameters set automatically by this method: 'relationship', 'relationship_guid', 'inverse_relationship'
Returns
array

Definition at line 1401 of file ElggEntity.php.

ElggEntity::getSubtype ( )

Get the entity subtype.

Returns
string The entity subtype

Implements Loggable.

Definition at line 1126 of file ElggEntity.php.

ElggEntity::getSystemLogID ( )

Return an identification for the object for storage in the system log.

This id must be an integer.

Returns
int

Implements Loggable.

Definition at line 2265 of file ElggEntity.php.

ElggEntity::getTags (   $tag_names = null)

Returns tags for this entity.

Warning
Tags must be registered by elgg_register_tag_metadata_name().
Parameters
array$tag_namesOptionally restrict by tag metadata names.
Returns
array

Definition at line 2289 of file ElggEntity.php.

ElggEntity::getTimeUpdated ( )

Returns the UNIX epoch time that this entity was last updated.

Returns
int UNIX epoch time

Definition at line 1187 of file ElggEntity.php.

ElggEntity::getType ( )

Returns the entity type.

Returns
string The entity type

Implements Loggable.

Definition at line 1117 of file ElggEntity.php.

ElggEntity::getURL ( )

Gets the URL for this entity.

Plugins can register for the 'entity:url', <type> plugin hook to customize the url for an entity.

Returns
string The URL of the entity

Definition at line 1199 of file ElggEntity.php.

ElggEntity::getVolatileData (   $name)

Get a piece of volatile (non-persisted) data on this entity.

Parameters
string$nameThe name of the volatile data
Returns
mixed The value or null if not found.

Definition at line 568 of file ElggEntity.php.

ElggEntity::hasIcon (   $size,
  $type = 'icon' 
)

Returns if the entity has an icon of the passed type.

Parameters
string$sizeThe size of the icon
string$typeThe name of the icon. e.g., 'icon', 'cover_photo'
Returns
bool

Implements Elgg\EntityIcon.

Definition at line 1333 of file ElggEntity.php.

ElggEntity::import ( ODD  $data)

Import data from an parsed ODD xml data array.

Parameters
ODD$dataXML data
Returns
true
Exceptions
InvalidParameterException

Implements Importable.

Definition at line 2235 of file ElggEntity.php.

ElggEntity::initializeAttributes ( )
protected

Initialize the attributes array.

This is vital to distinguish between metadata and base parameters.

Returns
void

Definition at line 89 of file ElggEntity.php.

ElggEntity::isEnabled ( )

Is this entity enabled?

Returns
boolean Whether this entity is enabled.

Definition at line 1895 of file ElggEntity.php.

ElggEntity::isFullyLoaded ( )

Tests to see whether the object has been persisted.

Returns
bool

Definition at line 1417 of file ElggEntity.php.

ElggEntity::load (   $guid)
protected

Loads attributes from the entities table into the object.

Parameters
mixed$guidGUID of entity or object from entities table
Returns
bool

Definition at line 1662 of file ElggEntity.php.

ElggEntity::loadAdditionalSelectValues ( array  $data)
protected

Stores non-attributes from the loading of the entity as volatile data.

Parameters
array$dataKey value array
Returns
void

Definition at line 1704 of file ElggEntity.php.

ElggEntity::prepareObject (   $object)
protected

Prepare an object copy for toObject()

Parameters
\stdClass$objectObject representation of the entity
Returns

Definition at line 2039 of file ElggEntity.php.

ElggEntity::refresh ( \stdClass  $row)

Load new data from database into existing entity.

Overwrites data but does not change values not included in the latest data.

Definition at line 1722 of file ElggEntity.php.

ElggEntity::removeFromSite (   $site)

Remove this entity from a site.

This deletes the 'member_of_site' relationship.

Parameters
\ElggSite$siteThe site to remove this entity from
Returns
bool

Definition at line 1381 of file ElggEntity.php.

ElggEntity::removePrivateSetting (   $name)

Removes private setting.

Parameters
string$nameName of the private setting
Returns
bool

Definition at line 690 of file ElggEntity.php.

ElggEntity::removeRelationship (   $guid_two,
  $relationship 
)

Remove a relationship.

Parameters
int$guid_twoGUID of the target entity of the relationship.
string$relationshipThe type of relationship.
Returns
bool
See Also
::addRelationship()
::deleteRelationships()

Definition at line 641 of file ElggEntity.php.

ElggEntity::save ( )

Save an entity.

Returns
bool|int
Exceptions
InvalidParameterException
IOException

Definition at line 1428 of file ElggEntity.php.

ElggEntity::saveIconFromElggFile ( \ElggFile  $file,
  $type = 'icon',
array  $coords = array() 
)

Saves icons using a file located in the data store as the source.

Parameters
string$fileAn ElggFile instance
string$typeThe name of the icon. e.g., 'icon', 'cover_photo'
array$coordsAn array of cropping coordinates x1, y1, x2, y2
Returns
bool

Implements Elgg\EntityIcon.

Definition at line 1288 of file ElggEntity.php.

ElggEntity::saveIconFromLocalFile (   $filename,
  $type = 'icon',
array  $coords = array() 
)

Saves icons using a local file as the source.

Parameters
string$filenameThe full path to the local file
string$typeThe name of the icon. e.g., 'icon', 'cover_photo'
array$coordsAn array of cropping coordinates x1, y1, x2, y2
Returns
bool

Implements Elgg\EntityIcon.

Definition at line 1276 of file ElggEntity.php.

ElggEntity::saveIconFromUploadedFile (   $input_name,
  $type = 'icon',
array  $coords = array() 
)

Saves icons using an uploaded file as the source.

Parameters
string$input_nameForm input name
string$typeThe name of the icon. e.g., 'icon', 'cover_photo'
array$coordsAn array of cropping coordinates x1, y1, x2, y2
Returns
bool

Implements Elgg\EntityIcon.

Definition at line 1264 of file ElggEntity.php.

ElggEntity::set (   $name,
  $value 
)

Sets the value of an attribute or metadata.

Parameters
string$nameName
mixed$valueValue
Returns
bool

Definition at line 234 of file ElggEntity.php.

ElggEntity::setContainerGUID (   $container_guid)

Set the container for this object.

Parameters
int$container_guidThe ID of the container.
Returns
bool

Definition at line 1159 of file ElggEntity.php.

ElggEntity::setDisplayName (   $displayName)
abstract

Sets the title or name of this entity.

Parameters
string$displayNameThe title or name of this entity.
Returns
void
ElggEntity::setLatLong (   $lat,
  $long 
)

Set latitude and longitude metadata tags for a given entity.

Parameters
float$latLatitude
float$longLongitude
Returns
void

Implements Locatable.

Definition at line 2086 of file ElggEntity.php.

ElggEntity::setLocation (   $location)

Sets the 'location' metadata for the entity.

Parameters
string$locationString representation of the location
Returns
void

Implements Locatable.

Definition at line 2073 of file ElggEntity.php.

ElggEntity::setMetadata (   $name,
  $value,
  $value_type = '',
  $multiple = false,
  $owner_guid = 0,
  $access_id = null 
)

Set metadata on this entity.

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.

Parameters
string$nameName of the metadata
mixed$valueValue of the metadata (doesn't support assoc arrays)
string$value_type'text', 'integer', or '' for automatic detection
bool$multipleAllow multiple values for a single name. Does not support associative arrays.
int$owner_guidGUID of entity that owns the metadata. Default is owner of entity.
int$access_idWho can read the metadata relative to the owner. Default is the access level of the entity.
Returns
bool
Exceptions
InvalidArgumentException

Definition at line 400 of file ElggEntity.php.

ElggEntity::setPrivateSetting (   $name,
  $value 
)

Adds a private setting to this entity.

Private settings are similar to metadata but will not be searched and there are fewer helper functions for them.

Parameters
string$nameName of private setting
mixed$valueValue of private setting
Returns
bool

Definition at line 656 of file ElggEntity.php.

ElggEntity::setURL (   $url)

Overrides the URL returned by getURL()

Warning
This override exists only for the life of the object.
Parameters
string$urlThe new item URL
Returns
string The URL

Definition at line 1250 of file ElggEntity.php.

ElggEntity::setVolatileData (   $name,
  $value 
)

Set a piece of volatile (non-persisted) data on this entity.

Parameters
string$nameName
mixed$valueValue
Returns
void

Definition at line 588 of file ElggEntity.php.

ElggEntity::toObject ( )

{}

Definition at line 2026 of file ElggEntity.php.

ElggEntity::update ( )
protected

Update the entity in the database.

Returns
bool Whether the update was successful.
Exceptions
InvalidParameterException

Definition at line 1590 of file ElggEntity.php.

Member Data Documentation

ElggEntity::$orig_attributes = array()
protected

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

Definition at line 80 of file ElggEntity.php.

ElggEntity::$temp_annotations = array()
protected

Holds annotations until entity is saved.

Once the entity is saved, annotations are written immediately to the database.

Definition at line 63 of file ElggEntity.php.

ElggEntity::$temp_metadata = array()
protected

Holds metadata until entity is saved.

Once the entity is saved, metadata are written immediately to the database.

Definition at line 57 of file ElggEntity.php.

ElggEntity::$temp_private_settings = array()
protected

Holds private settings until entity is saved.

Once the entity is saved, private settings are written immediately to the database.

Definition at line 69 of file ElggEntity.php.

ElggEntity::$url_override
protected

If set, overrides the value of getURL()

Definition at line 51 of file ElggEntity.php.

ElggEntity::$volatile = array()
protected

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

Definition at line 75 of file ElggEntity.php.


The documentation for this class was generated from the following file: