Elgg
Version 6.1
|
Public Member Functions | |
__construct (stdClass $row=null) | |
Create a new entity. More... | |
__clone () | |
Clone an entity. More... | |
__set ($name, $value) | |
Set an attribute or metadata value for this entity. 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... | |
getDisplayName () | |
Get the entity's display name. More... | |
setDisplayName (string $display_name) | |
Sets the title or name of this entity. More... | |
getVolatileData (string $name) | |
Get a piece of volatile (non-persisted) data on this entity. More... | |
setVolatileData (string $name, $value) | |
Set a piece of volatile (non-persisted) data on this entity. More... | |
removeAllRelatedRiverItems () | |
Removes all river items related to this entity. More... | |
countComments () | |
Count the number of comments attached to this entity. More... | |
hasAccess (int $user_guid=0) | |
Check if the given user has access to this entity. More... | |
canEdit (int $user_guid=0) | |
Can a user edit this entity? More... | |
canDelete (int $user_guid=0) | |
Can a user delete this entity? More... | |
canWriteToContainer (int $user_guid=0, string $type= '', string $subtype= '') | |
Can a user add an entity to this container. More... | |
canComment (int $user_guid=0) | |
Can a user comment on an entity? More... | |
canAnnotate (int $user_guid=0, string $annotation_name= '') | |
Can a user annotate an entity? More... | |
getGUID () | |
Returns the guid. More... | |
getType () | |
Returns the entity type. More... | |
setSubtype (string $subtype) | |
Set the subtype of the entity. 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 (int $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... | |
save () | |
disable (string $reason= '', bool $recursive=true) | |
Disable this entity. More... | |
enable (bool $recursive=true) | |
Enable the entity. More... | |
isEnabled () | |
Is this entity enabled? More... | |
delete (bool $recursive=true, bool $persistent=null) | |
Deletes the entity. More... | |
restore (bool $recursive=true) | |
Restore the entity. More... | |
isDeleted () | |
Is the entity marked as deleted. More... | |
toObject (array $params=[]) | |
Export an entity. More... | |
setLatLong (float $lat, float $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... | |
getSystemLogID () | |
{} More... | |
getObjectFromID (int $id) | |
For a given ID, return the object associated with it. More... | |
updateLastAction (int $posted=null) | |
Update the last_action column in the entities table. More... | |
updateTimeDeleted (int $deleted=null) | |
Update the time_deleted column in the entities table. More... | |
disableCaching () | |
Disable runtime caching for entity. More... | |
enableCaching () | |
Enable runtime caching for entity. More... | |
isCacheable () | |
Is entity cacheable in the runtime cache. More... | |
cache () | |
Cache the entity in a session cache. More... | |
invalidateCache () | |
Invalidate cache for entity. More... | |
hasCapability (string $capability) | |
Checks a specific capability is enabled for the entity type/subtype. More... | |
Public Member Functions inherited from ElggData | |
__isset ($name) | |
Test if property is set either as an attribute or metadata. More... | |
__unset ($name) | |
Unset a property from metadata or attribute. 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 (array $params=[]) | |
Get a plain old object copy for public consumption. More... | |
getSystemLogID () | |
Return an identification for the object for storage in the system log. More... | |
getType () | |
Return the type of the object - eg. More... | |
getSubtype () | |
Return a subtype. More... | |
getObjectFromID (int $id) | |
For a given ID, return the object associated with it. More... | |
rewind () | |
Iterator interface. More... | |
current () | |
Iterator interface. More... | |
key () | |
Iterator interface. More... | |
next () | |
Iterator interface. More... | |
valid () | |
Iterator interface. More... | |
offsetSet ($offset, $value) | |
Array access interface. More... | |
offsetGet ($offset) | |
Array access interface. More... | |
offsetUnset ($offset) | |
Array access interface. More... | |
offsetExists ($offset) | |
Array access interface. More... | |
getID () | |
{Get unique item identifier within a collection.
| |
getPriority () | |
{Get priority (weight) of the item within a collection.
| |
__serialize () | |
Called during serialization. More... | |
__unserialize (array $data) | |
Called during unserialization. More... | |
Public Attributes | |
const | PRIMARY_ATTR_NAMES |
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 (stdClass $row) | |
Loads attributes from the entities table into the object. More... | |
persistentDelete (bool $recursive=true) | |
Permanently delete the entity from the database. More... | |
trash (bool $recursive=true) | |
Move the entity to the trash. More... | |
prepareObject (\Elgg\Export\Entity $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... | |
Protected Attributes | |
const | INTEGER_ATTR_NAMES |
$volatile = [] | |
$orig_attributes = [] | |
$_is_cacheable = true | |
Protected Attributes inherited from ElggData | |
$attributes = [] | |
$valid = false | |
Definition at line 52 of file ElggEntity.php.
ElggEntity::__construct | ( | stdClass | $row = null | ) |
Create a new entity.
Plugin developers should only use the constructor to create a new entity. To retrieve entities, use get_entity() and the elgg_get_entities* functions.
If no arguments are passed, it creates a new entity. If a database result is passed as a instance, it instantiates that entity.
stdClass | $row | Database row result. Default is null to create a new object. |
IOException | If cannot load remaining data from db |
Definition at line 122 of file ElggEntity.php.
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.
Definition at line 165 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.
string | $name | Name of the attribute or metadata |
Definition at line 293 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.
Be advised that metadata values are cast to integer or string. You can save booleans, but they will be stored and returned as integers.
string | $name | Name of the attribute or metadata |
mixed | $value | The value to be set |
Definition at line 218 of file ElggEntity.php.
ElggEntity::cache | ( | ) |
ElggEntity::canAnnotate | ( | int | $user_guid = 0 , |
string | $annotation_name = '' |
||
) |
Can a user annotate an entity?
Can be overridden by registering for the event [permissions_check:annotate:<name>, <entity type>="">] or [permissions_check:annotate, <entity type>="">]. The events 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 event.
int | $user_guid | User guid (default is logged in user) |
string | $annotation_name | The name of the annotation (default is unspecified) |
Definition at line 460 of file ElggEntity.php.
ElggEntity::canComment | ( | int | $user_guid = 0 | ) |
Can a user comment on an entity?
Can be overridden by registering for the 'permissions_check:comment', '<entity type>="">' event.
int | $user_guid | User guid (default is logged in user) |
Definition at line 442 of file ElggEntity.php.
ElggEntity::canDelete | ( | int | $user_guid = 0 | ) |
Can a user delete this entity?
Can be overridden by registering for the permissions_check:delete event.
int | $user_guid | The user GUID, optionally (default: logged in user) |
Definition at line 411 of file ElggEntity.php.
ElggEntity::canEdit | ( | int | $user_guid = 0 | ) |
Can a user edit this entity?
Can be overridden by registering for the permissions_check event.
int | $user_guid | The user GUID, optionally (default: logged in user) |
Definition at line 397 of file ElggEntity.php.
ElggEntity::canWriteToContainer | ( | int | $user_guid = 0 , |
string | $type = '' , |
||
string | $subtype = '' |
||
) |
Can a user add an entity to this container.
int | $user_guid | The GUID of the user creating the entity (0 for logged in user). |
string | $type | The type of entity we're looking to write |
string | $subtype | The subtype of the entity we're looking to write |
Definition at line 425 of file ElggEntity.php.
ElggEntity::countComments | ( | ) |
Count the number of comments attached to this entity.
Definition at line 361 of file ElggEntity.php.
|
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.
Definition at line 614 of file ElggEntity.php.
ElggEntity::delete | ( | bool | $recursive = true , |
bool | $persistent = null |
||
) |
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.
bool | $recursive | If true (default) then all entities which are owned or contained by $this will also be deleted. |
bool | null | $persistent | persistently delete the entity (default: check the 'restorable' capability) |
Definition at line 1021 of file ElggEntity.php.
ElggEntity::disable | ( | string | $reason = '' , |
bool | $recursive = true |
||
) |
Disable this entity.
Disabled entities are not returned by getter functions. To enable an entity, use ElggEntity::enable().Recursivelydisablinganentitywilldisableallentitiesownedorcontainedbytheparententity.@noteInternal:Disablinganentitysetsthe'enabled'columnto'no'.@paramstring$reasonOptionalreason@parambool$recursiveRecursivelydisableallcontainedentities?@returnbool@see\ElggEntity::enable()
Definition at line 868 of file ElggEntity.php.
ElggEntity::disableCaching | ( | ) |
ElggEntity::enable | ( | bool | $recursive = true | ) |
Enable the entity.
bool | $recursive | Recursively enable all entities disabled with the entity? |
Definition at line 950 of file ElggEntity.php.
ElggEntity::enableCaching | ( | ) |
ElggEntity::getContainerEntity | ( | ) |
Get the container entity for this object.
Definition at line 552 of file ElggEntity.php.
ElggEntity::getContainerGUID | ( | ) |
ElggEntity::getDisplayName | ( | ) |
Get the entity's display name.
Definition at line 306 of file ElggEntity.php.
ElggEntity::getGUID | ( | ) |
ElggEntity::getLatitude | ( | ) |
ElggEntity::getLongitude | ( | ) |
ElggEntity::getObjectFromID | ( | int | $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.
int | $id | GUID |
Definition at line 1227 of file ElggEntity.php.
ElggEntity::getOriginalAttributes | ( | ) |
Get the original values of attribute(s) that have been modified since the entity was persisted.
Definition at line 276 of file ElggEntity.php.
ElggEntity::getOwnerEntity | ( | ) |
ElggEntity::getOwnerGUID | ( | ) |
Get the guid of the entity's owner.
Definition at line 513 of file ElggEntity.php.
ElggEntity::getSubtype | ( | ) |
Get the entity subtype.
Definition at line 504 of file ElggEntity.php.
ElggEntity::getSystemLogID | ( | ) |
{}
Definition at line 1215 of file ElggEntity.php.
ElggEntity::getTimeUpdated | ( | ) |
Returns the UNIX epoch time that this entity was last updated.
Definition at line 561 of file ElggEntity.php.
ElggEntity::getType | ( | ) |
Returns the entity type.
Definition at line 478 of file ElggEntity.php.
ElggEntity::getURL | ( | ) |
Gets the URL for this entity.
Plugins can register for the 'entity:url', '<type>' event to customize the url for an entity.
Definition at line 573 of file ElggEntity.php.
ElggEntity::getVolatileData | ( | string | $name | ) |
Get a piece of volatile (non-persisted) data on this entity.
string | $name | The name of the volatile data |
Definition at line 328 of file ElggEntity.php.
ElggEntity::hasAccess | ( | int | $user_guid = 0 | ) |
Check if the given user has access to this entity.
int | $user_guid | the GUID of the user to check access for (default: logged in user_guid) |
Definition at line 384 of file ElggEntity.php.
ElggEntity::hasCapability | ( | string | $capability | ) |
Checks a specific capability is enabled for the entity type/subtype.
string | $capability | capability to check |
Definition at line 1346 of file ElggEntity.php.
|
protected |
Initialize the attributes array.
This is vital to distinguish between metadata and base parameters.
Definition at line 137 of file ElggEntity.php.
ElggEntity::invalidateCache | ( | ) |
ElggEntity::isCacheable | ( | ) |
Is entity cacheable in the runtime cache.
Definition at line 1297 of file ElggEntity.php.
ElggEntity::isDeleted | ( | ) |
ElggEntity::isEnabled | ( | ) |
Is this entity enabled?
Definition at line 1000 of file ElggEntity.php.
|
protected |
Loads attributes from the entities table into the object.
stdClass | $row | Object of properties from database row(s) |
Definition at line 824 of file ElggEntity.php.
|
protected |
Permanently delete the entity from the database.
bool | $recursive | If true (default) then all entities which are owned or contained by $this will also be deleted. |
Definition at line 1054 of file ElggEntity.php.
|
protected |
Prepare an object copy for toObject()
\Elgg\Export\Entity | $object | Object representation of the entity |
Definition at line 1164 of file ElggEntity.php.
ElggEntity::removeAllRelatedRiverItems | ( | ) |
Removes all river items related to this entity.
Definition at line 349 of file ElggEntity.php.
ElggEntity::restore | ( | bool | $recursive = true | ) |
Restore the entity.
bool | $recursive | Recursively restores all entities trashed with the entity? |
Definition at line 1083 of file ElggEntity.php.
ElggEntity::save | ( | ) |
Definition at line 588 of file ElggEntity.php.
ElggEntity::setContainerGUID | ( | int | $container_guid | ) |
Set the container for this object.
int | $container_guid | The ID of the container. |
Definition at line 533 of file ElggEntity.php.
ElggEntity::setDisplayName | ( | string | $display_name | ) |
Sets the title or name of this entity.
string | $display_name | The title or name of this entity. |
Definition at line 317 of file ElggEntity.php.
ElggEntity::setLatLong | ( | float | $lat, |
float | $long | ||
) |
Set latitude and longitude metadata tags for a given entity.
float | $lat | Latitude |
float | $long | Longitude |
Definition at line 1185 of file ElggEntity.php.
ElggEntity::setSubtype | ( | string | $subtype | ) |
Set the subtype of the entity.
string | $subtype | the new type |
Definition at line 490 of file ElggEntity.php.
ElggEntity::setVolatileData | ( | string | $name, |
$value | |||
) |
Set a piece of volatile (non-persisted) data on this entity.
string | $name | Name |
mixed | $value | Value |
Definition at line 340 of file ElggEntity.php.
ElggEntity::toObject | ( | array | $params = [] | ) |
Export an entity.
array | $params | Params to pass to the event |
Definition at line 1149 of file ElggEntity.php.
|
protected |
Move the entity to the trash.
bool | $recursive | If true (default) then all entities which are owned or contained by $this will also be trashed. |
Definition at line 1066 of file ElggEntity.php.
|
protected |
Update the entity in the database.
Definition at line 759 of file ElggEntity.php.
ElggEntity::updateLastAction | ( | int | $posted = null | ) |
Update the last_action column in the entities table.
int | $posted | Timestamp of last action |
Definition at line 1242 of file ElggEntity.php.
ElggEntity::updateTimeDeleted | ( | int | $deleted = null | ) |
Update the time_deleted column in the entities table.
int | $deleted | Timestamp of deletion |
Definition at line 1259 of file ElggEntity.php.
|
protected |
Definition at line 106 of file ElggEntity.php.
|
protected |
Definition at line 101 of file ElggEntity.php.
|
protected |
Definition at line 95 of file ElggEntity.php.
|
protected |
Definition at line 79 of file ElggEntity.php.
const ElggEntity::PRIMARY_ATTR_NAMES |
Definition at line 61 of file ElggEntity.php.