ElggEntity Class Reference

Inheritance diagram for ElggEntity:
ElggData Notable Locatable Importable Loggable Exportable ElggGroup ElggObject ElggSite ElggUser ElggFile ElggPlugin ElggWidget

List of all members.

Public Member Functions

 __clone ()
 Clone an entity.
 get ($name)
 Return the value of a property.
 set ($name, $value)
 Sets the value of a property.
 getMetaData ($name)
 Return the value of a piece of metadata.
 __unset ($name)
 Unset a property from metadata or attribute.
 setMetaData ($name, $value, $value_type=null, $multiple=false)
 Set a piece of metadata.
 deleteMetadata ($name=null)
 Deletes all metadata on this object (metadata.entity_guid = $this->guid).
 deleteOwnedMetadata ($name=null)
 Deletes all metadata owned by this object (metadata.owner_guid = $this->guid).
 clearMetaData ($name= '')
 Remove metadata.
 disableMetadata ($name= '')
 Disables metadata for this entity, optionally based on name.
 enableMetadata ($name= '')
 Enables metadata for this entity, optionally based on name.
 getVolatileData ($name)
 Get a piece of volatile (non-persisted) data on this entity.
 setVolatileData ($name, $value)
 Set a piece of volatile (non-persisted) data on this entity.
 deleteRelationships ()
 Remove all relationships to and from this entity.
 clearRelationships ()
 Remove all relationships to and from this entity.
 addRelationship ($guid, $relationship)
 Add a relationship between this an another entity.
 removeRelationship ($guid, $relationship)
 Remove a relationship.
 setPrivateSetting ($name, $value)
 Adds a private setting to this entity.
 getPrivateSetting ($name)
 Returns a private setting value.
 removePrivateSetting ($name)
 Removes private setting.
 deleteAnnotations ($name=null)
 Deletes all annotations on this object (annotations.entity_guid = $this->guid).
 deleteOwnedAnnotations ($name=null)
 Deletes all annotations owned by this object (annotations.owner_guid = $this->guid).
 disableAnnotations ($name= '')
 Disables annotations for this entity, optionally based on name.
 enableAnnotations ($name= '')
 Enables annotations for this entity, optionally based on name.
 annotate ($name, $value, $access_id=ACCESS_PRIVATE, $owner_id=0, $vartype="")
 Adds an annotation to an entity.
 getAnnotations ($name, $limit=50, $offset=0, $order="asc")
 Returns an array of annotations.
 clearAnnotations ($name="")
 Remove an annotation or all annotations for this entity.
 countAnnotations ($name="")
 Count annotations.
 getAnnotationsAvg ($name)
 Get the average of an integer type annotation.
 getAnnotationsSum ($name)
 Get the sum of integer type annotations of a given name.
 getAnnotationsMin ($name)
 Get the minimum of integer type annotations of given name.
 getAnnotationsMax ($name)
 Get the maximum of integer type annotations of a given name.
 countComments ()
 Count the number of comments attached to this entity.
 getEntitiesFromRelationship ($relationship, $inverse=false, $limit=50, $offset=0)
 Gets an array of entities with a relationship to this entity.
 countEntitiesFromRelationship ($relationship, $inverse_relationship=FALSE)
 Gets the number of of entities from a specific relationship type.
 canEdit ($user_guid=0)
 Can a user edit this entity.
 canEditMetadata ($metadata=null, $user_guid=0)
 Can a user edit metadata on this entity.
 canWriteToContainer ($user_guid=0, $type= 'all', $subtype= 'all')
 Can a user add an entity to this container.
 canComment ($user_guid=0)
 Can a user comment on an entity?
 canAnnotate ($user_guid=0, $annotation_name= '')
 Can a user annotate an entity?
 getAccessID ()
 Returns the access_id.
 getGUID ()
 Returns the guid.
 getType ()
 Returns the entity type.
 getSubtype ()
 Returns the entity subtype string.
 getOwnerGUID ()
 Get the guid of the entity's owner.
 getOwner ()
 Return the guid of the entity's owner.
 getOwnerEntity ()
 Gets the ElggEntity that owns this entity.
 setContainerGUID ($container_guid)
 Set the container for this object.
 setContainer ($container_guid)
 Set the container for this object.
 getContainerGUID ()
 Gets the container GUID for this entity.
 getContainer ()
 Gets the container GUID for this entity.
 getContainerEntity ()
 Get the container entity for this object.
 getTimeUpdated ()
 Returns the UNIX epoch time that this entity was last updated.
 getURL ()
 Returns the URL for this entity.
 setURL ($url)
 Overrides the URL returned by getURL().
 getIconURL ($size= 'medium')
 Get the URL for this entity's icon.
 getIcon ($size= 'medium')
 Returns a URL for the entity's icon.
 setIcon ($url, $size= 'medium')
 Set an icon override for an icon and size.
 isFullyLoaded ()
 Tests to see whether the object has been fully loaded.
 save ()
 Save an entity.
 disable ($reason="", $recursive=true)
 Disable this entity.
 enable ()
 Enable an entity.
 isEnabled ()
 Is this entity enabled?
 delete ($recursive=true)
 Delete this entity.
 getLocation ()
 Gets the 'location' metadata for the entity.
 setLocation ($location)
 Sets the 'location' metadata for the entity.
 setLatLong ($lat, $long)
 Set latitude and longitude metadata tags for a given entity.
 getLatitude ()
 Return the entity's latitude.
 getLongitude ()
 Return the entity's longitude.
 setCalendarTimeAndDuration ($hour=NULL, $minute=NULL, $second=NULL, $day=NULL, $month=NULL, $year=NULL, $duration=NULL)
 Set the time and duration of an object.
 getCalendarStartTime ()
 Returns the start timestamp.
 getCalendarEndTime ()
 Returns the end timestamp.
 getExportableValues ()
 Returns an array of fields which can be exported.
 export ()
 Export this class into an array of ODD Elements containing all necessary fields.
 import (ODD $data)
 Import data from an parsed ODD xml data array.
 getSystemLogID ()
 Return an identification for the object for storage in the system log.
 getObjectFromID ($id)
 For a given ID, return the object associated with it.
 getTags ($tag_names=NULL)
 Returns tags for this entity.

Protected Member Functions

 initializeAttributes ()
 Initialize the attributes array.
 load ($guid)
 Loads attributes from the entities table into the object.

Protected Attributes

 $url_override
 If set, overrides the value of getURL().
 $icon_override
 Icon override, overrides the value of getIcon().
 $temp_metadata = array()
 Holds metadata until entity is saved.
 $temp_annotations = array()
 Holds annotations until entity is saved.
 $temp_private_settings = array()
 Holds private settings until entity is saved.
 $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.

Detailed Description

Definition at line 39 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 135 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 $name The name of the attribute or metadata.
Returns:
void

Definition at line 310 of file ElggEntity.php.

ElggEntity::addRelationship ( guid,
relationship 
)

Add a relationship between this an another entity.

Read the relationship like "$guid is a $relationship of this entity."

Parameters:
int $guid Entity to link to.
string $relationship The type of relationship.
Returns:
bool
See also:
ElggEntity::removeRelationship()
ElggEntity::clearRelationships()

Definition at line 574 of file ElggEntity.php.

ElggEntity::annotate ( name,
value,
access_id = ACCESS_PRIVATE,
owner_id = 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 $name Annotation name
mixed $value Annotation value
int $access_id Access ID
int $owner_id GUID of the annotation owner
string $vartype The type of annotation value
Returns:
bool

Definition at line 761 of file ElggEntity.php.

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

Can a user annotate an entity?

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

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_guid User guid (default is logged in user)
string $annotation_name The name of the annotation (default is unspecified)
Returns:
bool

Definition at line 998 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_guid User guid (default is logged in user)
Returns:
bool

Reimplemented in ElggGroup, ElggObject, and ElggUser.

Definition at line 972 of file ElggEntity.php.

ElggEntity::canEdit ( user_guid = 0  ) 

Can a user edit this entity.

Parameters:
int $user_guid The user GUID, optionally (default: logged in user)
Returns:
bool

Definition at line 933 of file ElggEntity.php.

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

Can a user edit metadata on this entity.

Parameters:
ElggMetadata $metadata The piece of metadata to specifically check
int $user_guid The user GUID, optionally (default: logged in user)
Returns:
bool

Definition at line 945 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_guid The user.
string $type The type of entity we're looking to write
string $subtype The subtype of the entity we're looking to write
Returns:
bool

Definition at line 958 of file ElggEntity.php.

ElggEntity::clearAnnotations ( name = ""  ) 

Remove an annotation or all annotations for this entity.

Warning:
Calling this method with no or an empty argument will remove all annotations on the entity.
Parameters:
string $name Annotation name
Returns:
bool

Definition at line 812 of file ElggEntity.php.

ElggEntity::clearMetaData ( name = ''  ) 

Remove metadata.

Warning:
Calling this with no or empty arguments will clear all metadata on the entity.
Parameters:
string $name The name of the metadata to clear
Returns:
mixed bool

Definition at line 455 of file ElggEntity.php.

ElggEntity::clearRelationships (  ) 

Remove all relationships to and from this entity.

Returns:
bool
See also:
ElggEntity::addRelationship()
ElggEntity::removeRelationship()

Definition at line 557 of file ElggEntity.php.

ElggEntity::countAnnotations ( name = ""  ) 

Count annotations.

Parameters:
string $name The type of annotation.
Returns:
int

Definition at line 824 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 878 of file ElggEntity.php.

ElggEntity::countEntitiesFromRelationship ( relationship,
inverse_relationship = FALSE 
)

Gets the number of of entities from a specific relationship type.

Parameters:
string $relationship Relationship type (eg "friends")
bool $inverse_relationship Invert relationship
Returns:
int|false The number of entities or false on failure

Definition at line 917 of file ElggEntity.php.

ElggEntity::delete ( recursive = true  ) 

Delete this entity.

Parameters:
bool $recursive Whether to delete all the entities contained by this entity
Returns:
bool

Definition at line 1438 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 $name The annotations name to remove.
Returns:
bool
Since:
1.8

Definition at line 651 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 $name The name of the metadata to remove.
Returns:
bool
Since:
1.8

Definition at line 404 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 $name The name of annotations to delete.
Returns:
bool
Since:
1.8

Definition at line 671 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 $name The name of metadata to delete.
Returns:
bool
Since:
1.8

Definition at line 429 of file ElggEntity.php.

ElggEntity::deleteRelationships (  ) 

Remove all relationships to and from this entity.

Returns:
true
See also:
ElggEntity::addRelationship()
ElggEntity::removeRelationship()

Definition at line 543 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 enable_entity().

Recursively disabling an entity will disable all entities owned or contained by the parent entity.

Reimplemented in ElggSite.

Definition at line 1392 of file ElggEntity.php.

ElggEntity::disableAnnotations ( name = ''  ) 

Disables annotations for this entity, optionally based on name.

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

Definition at line 695 of file ElggEntity.php.

ElggEntity::disableMetadata ( name = ''  ) 

Disables metadata for this entity, optionally based on name.

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

Definition at line 467 of file ElggEntity.php.

ElggEntity::enable (  ) 

Enable an entity.

Warning:
Disabled entities can't be loaded unless access_show_hidden_entities(true) has been called.
See also:
enable_entity()
access_show_hiden_entities()
Returns:
bool

Definition at line 1410 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 $name An options name of annotations to enable.
Returns:
bool
Since:
1.8

Definition at line 716 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 $name An options name of metadata to enable.
Returns:
bool
Since:
1.8

Definition at line 488 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 1587 of file ElggEntity.php.

ElggEntity::get ( name  ) 

Return the value of a property.

If $name is defined in $this->attributes that value is returned, otherwise it will pull from the entity's metadata.

Q: Why are we not using __get overload here? A: Because overload operators cause problems during subclassing, so we put the code here and create overloads in subclasses.

Warning:
Subtype is returned as an id rather than the subtype string. Use getSubtype() to get the subtype string.
Parameters:
string $name Name
Returns:
mixed Returns the value of a given value, or null.

Reimplemented from ElggData.

Reimplemented in ElggGroup, ElggPlugin, and ElggWidget.

Definition at line 188 of file ElggEntity.php.

ElggEntity::getAccessID (  ) 

Returns the access_id.

Returns:
int The access ID

Definition at line 1022 of file ElggEntity.php.

ElggEntity::getAnnotations ( name,
limit = 50,
offset = 0,
order = "asc" 
)

Returns an array of annotations.

Parameters:
string $name Annotation name
int $limit Limit
int $offset Offset
string $order Order by time: asc or desc
Returns:
array

Definition at line 780 of file ElggEntity.php.

ElggEntity::getAnnotationsAvg ( name  ) 

Get the average of an integer type annotation.

Parameters:
string $name Annotation name
Returns:
int

Definition at line 835 of file ElggEntity.php.

ElggEntity::getAnnotationsMax ( name  ) 

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

Parameters:
string $name Annotation name
Returns:
int

Definition at line 868 of file ElggEntity.php.

ElggEntity::getAnnotationsMin ( name  ) 

Get the minimum of integer type annotations of given name.

Parameters:
string $name Annotation name
Returns:
int

Definition at line 857 of file ElggEntity.php.

ElggEntity::getAnnotationsSum ( name  ) 

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

Parameters:
string $name Annotation name
Returns:
int

Definition at line 846 of file ElggEntity.php.

ElggEntity::getCalendarEndTime (  ) 

Returns the end timestamp.

Returns:
int

Implements Notable.

Definition at line 1554 of file ElggEntity.php.

ElggEntity::getCalendarStartTime (  ) 

Returns the start timestamp.

Returns:
int

Implements Notable.

Definition at line 1543 of file ElggEntity.php.

ElggEntity::getContainer (  ) 

Gets the container GUID for this entity.

Returns:
int

Definition at line 1132 of file ElggEntity.php.

ElggEntity::getContainerEntity (  ) 

Get the container entity for this object.

Returns:
ElggEntity
Since:
1.8.0

Definition at line 1143 of file ElggEntity.php.

ElggEntity::getContainerGUID (  ) 

Gets the container GUID for this entity.

Returns:
int

Definition at line 1122 of file ElggEntity.php.

ElggEntity::getEntitiesFromRelationship ( relationship,
inverse = false,
limit = 50,
offset = 0 
)

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

Parameters:
string $relationship Relationship type (eg "friends")
bool $inverse Is this an inverse relationship?
int $limit Number of elements to return
int $offset Indexing offset
Returns:
array|false An array of entities or false on failure

Definition at line 899 of file ElggEntity.php.

ElggEntity::getExportableValues (  ) 

Returns an array of fields which can be exported.

Returns:
array

Implements Exportable.

Reimplemented in ElggGroup, ElggObject, ElggSite, and ElggUser.

Definition at line 1567 of file ElggEntity.php.

ElggEntity::getGUID (  ) 

Returns the guid.

Returns:
int|null GUID

Definition at line 1031 of file ElggEntity.php.

ElggEntity::getIcon ( size = 'medium'  ) 

Returns a URL for the entity's icon.

Parameters:
string $size Either 'large', 'medium', 'small' or 'tiny'
Returns:
string The url or false if no url could be worked out.

Definition at line 1225 of file ElggEntity.php.

ElggEntity::getIconURL ( size = 'medium'  ) 

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:
string $size Size of the icon: tiny, small, medium, large
Returns:
string The URL
Since:
1.8.0

Definition at line 1195 of file ElggEntity.php.

ElggEntity::getLatitude (  ) 

Return the entity's latitude.

Returns:
float

Implements Locatable.

Definition at line 1491 of file ElggEntity.php.

ElggEntity::getLocation (  ) 

Gets the 'location' metadata for the entity.

Returns:
string The location

Implements Locatable.

Definition at line 1451 of file ElggEntity.php.

ElggEntity::getLongitude (  ) 

Return the entity's longitude.

Returns:
float

Implements Locatable.

Definition at line 1500 of file ElggEntity.php.

ElggEntity::getMetaData ( name  ) 

Return the value of a piece of metadata.

Parameters:
string $name Name
Returns:
mixed The value, or NULL if not found.

Definition at line 251 of file ElggEntity.php.

ElggEntity::getObjectFromID ( id  ) 

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

This is used by the river functionality primarily.

This is useful for checking access permissions etc on objects.

Parameters:
int $id GUID.
Returns:
int GUID

Implements Loggable.

Definition at line 1723 of file ElggEntity.php.

ElggEntity::getOwner (  ) 

Return the guid of the entity's owner.

Returns:
int The owner GUID

Reimplemented in ElggUser.

Definition at line 1075 of file ElggEntity.php.

ElggEntity::getOwnerEntity (  ) 

Gets the ElggEntity that owns this entity.

Returns:
ElggEntity The owning entity

Definition at line 1085 of file ElggEntity.php.

ElggEntity::getOwnerGUID (  ) 

Get the guid of the entity's owner.

Returns:
int The owner GUID

Reimplemented in ElggUser.

Definition at line 1065 of file ElggEntity.php.

ElggEntity::getPrivateSetting ( name  ) 

Returns a private setting value.

Parameters:
string $name Name of the private setting
Returns:
mixed

Definition at line 619 of file ElggEntity.php.

ElggEntity::getSubtype (  ) 

Returns the entity subtype string.

Note:
This returns a string. If you want the id, use ElggEntity::subtype.
Returns:
string The entity subtype

Implements Loggable.

Definition at line 1051 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 1706 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_names Optionally restrict by tag metadata names.
Returns:
array

Definition at line 1736 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 1152 of file ElggEntity.php.

ElggEntity::getType (  ) 

Returns the entity type.

Returns:
string Entity type

Implements Loggable.

Definition at line 1040 of file ElggEntity.php.

ElggEntity::getURL (  ) 

Returns the URL for this entity.

Returns:
string The URL
See also:
register_entity_url_handler()
ElggEntity::setURL()

Reimplemented from ElggData.

Definition at line 1163 of file ElggEntity.php.

ElggEntity::getVolatileData ( name  ) 

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

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

Definition at line 507 of file ElggEntity.php.

ElggEntity::import ( ODD data  ) 

Import data from an parsed ODD xml data array.

Parameters:
ODD $data XML data
Returns:
true
Exceptions:
InvalidParameterException 

Implements Importable.

Definition at line 1677 of file ElggEntity.php.

ElggEntity::initializeAttributes (  )  [protected]

Initialize the attributes array.

This is vital to distinguish between metadata and base parameters.

Returns:
void

Reimplemented from ElggData.

Reimplemented in ElggFile, ElggGroup, ElggObject, ElggPlugin, ElggSite, ElggUser, and ElggWidget.

Definition at line 86 of file ElggEntity.php.

ElggEntity::isEnabled (  ) 

Is this entity enabled?

Returns:
boolean

Definition at line 1423 of file ElggEntity.php.

ElggEntity::isFullyLoaded (  ) 

Tests to see whether the object has been fully loaded.

Returns:
bool

Definition at line 1260 of file ElggEntity.php.

ElggEntity::load ( guid  )  [protected]

Loads attributes from the entities table into the object.

Parameters:
mixed $guid GUID of entity or stdClass object from entities table
Returns:
bool

Reimplemented in ElggGroup, ElggObject, ElggSite, and ElggUser.

Definition at line 1336 of file ElggEntity.php.

ElggEntity::removePrivateSetting ( name  ) 

Removes private setting.

Parameters:
string $name Name of the private setting
Returns:
bool

Definition at line 637 of file ElggEntity.php.

ElggEntity::removeRelationship ( guid,
relationship 
)

Remove a relationship.

Parameters:
int $guid GUID of the entity to make a relationship with
str $relationship Name of relationship
Returns:
bool
See also:
ElggEntity::addRelationship()
ElggEntity::clearRelationships()

Definition at line 588 of file ElggEntity.php.

ElggEntity::save (  ) 

Save an entity.

Returns:
bool|int
Exceptions:
IOException 

Reimplemented from ElggData.

Reimplemented in ElggFile, ElggGroup, ElggObject, ElggPlugin, ElggSite, and ElggUser.

Definition at line 1270 of file ElggEntity.php.

ElggEntity::set ( name,
value 
)

Sets the value of a property.

If $name is defined in $this->attributes that value is set, otherwise it is saved as metadata.

Warning:
Metadata set this way will inherit the entity's owner and access ID. If you want to set metadata with a different owner, use create_metadata().
It is important that your class populates $this->attributes with keys for all base attributes, anything not in their gets set as METADATA.

Q: Why are we not using __set overload here? A: Because overload operators cause problems during subclassing, so we put the code here and create overloads in subclasses.

Parameters:
string $name Name
mixed $value Value
Returns:
bool

Reimplemented from ElggData.

Reimplemented in ElggPlugin, and ElggWidget.

Definition at line 224 of file ElggEntity.php.

ElggEntity::setCalendarTimeAndDuration ( hour = NULL,
minute = NULL,
second = NULL,
day = NULL,
month = NULL,
year = NULL,
duration = NULL 
)

Set the time and duration of an object.

Parameters:
int $hour If ommitted, now is assumed.
int $minute If ommitted, now is assumed.
int $second If ommitted, now is assumed.
int $day If ommitted, now is assumed.
int $month If ommitted, now is assumed.
int $year If ommitted, now is assumed.
int $duration Duration of event, remainder of the day is assumed.
Returns:
true

Implements Notable.

Definition at line 1522 of file ElggEntity.php.

ElggEntity::setContainer ( container_guid  ) 

Set the container for this object.

Parameters:
int $container_guid The ID of the container.
Returns:
bool

Definition at line 1110 of file ElggEntity.php.

ElggEntity::setContainerGUID ( container_guid  ) 

Set the container for this object.

Parameters:
int $container_guid The ID of the container.
Returns:
bool

Definition at line 1096 of file ElggEntity.php.

ElggEntity::setIcon ( url,
size = 'medium' 
)

Set an icon override for an icon and size.

Warning:
This override exists only for the life of the object.
Parameters:
string $url The url of the icon.
string $size The size its for.
Returns:
bool

Definition at line 1241 of file ElggEntity.php.

ElggEntity::setLatLong ( lat,
long 
)

Set latitude and longitude metadata tags for a given entity.

Parameters:
float $lat Latitude
float $long Longitude
Returns:
bool

Implements Locatable.

Definition at line 1478 of file ElggEntity.php.

ElggEntity::setLocation ( location  ) 

Sets the 'location' metadata for the entity.

Parameters:
string $location String representation of the location
Returns:
bool

Implements Locatable.

Definition at line 1464 of file ElggEntity.php.

ElggEntity::setMetaData ( name,
value,
value_type = null,
multiple = false 
)

Set a piece of metadata.

Plugin authors should use the magic methods or create_metadata().

Warning:
The metadata will inherit the parent entity's owner and access ID. If you want to write metadata with a different owner, use create_metadata().

private

Parameters:
string $name Name of the metadata
mixed $value Value of the metadata (doesn't support assoc arrays)
string $value_type Types supported: integer and string. Will auto-identify if not set
bool $multiple Allow multiple values for a single name (doesn't support assoc arrays)
Returns:
bool

Definition at line 335 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 $name Name of private setting
mixed $value Value of private setting
Returns:
bool

Definition at line 603 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 $url The new item URL
Returns:
string The URL

Definition at line 1179 of file ElggEntity.php.

ElggEntity::setVolatileData ( name,
value 
)

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

Parameters:
string $name Name
mixed $value Value
Returns:
void

Definition at line 527 of file ElggEntity.php.


Member Data Documentation

ElggEntity::$icon_override [protected]

Icon override, overrides the value of getIcon().

Definition at line 53 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 65 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 59 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 71 of file ElggEntity.php.

ElggEntity::$url_override [protected]

If set, overrides the value of getURL().

Definition at line 48 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 77 of file ElggEntity.php.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations
Generated on Tue May 21 00:01:19 2013 for Elgg by  doxygen 1.6.3