31 parent::initializeAttributes();
33 $this->attributes[
'type'] =
"object";
48 'description' =>
null,
72 if (
$row instanceof \stdClass) {
75 $msg =
"Failed to load new " . get_class($this) .
" for GUID: " .
$row->guid;
76 throw new \IOException($msg);
78 }
else if (is_numeric(
$row)) {
82 throw new \IOException(
"Failed to load new " . get_class($this) .
" from GUID:" .
$row);
85 throw new \InvalidParameterException(
"Unrecognized value passed to constuctor.");
99 $attr_loader = new \Elgg\AttributeLoader(get_class(),
'object', $this->attributes);
100 $attr_loader->requires_access_control = !($this instanceof \ElggPlugin);
101 $attr_loader->secondary_loader =
'get_object_entity_as_row';
103 $attrs = $attr_loader->getRequiredAttributes(
$guid);
108 $this->attributes =
$attrs;
120 $guid = parent::create();
128 $query =
"INSERT INTO {$dbprefix}objects_entity
129 (guid, title, description)
131 (:guid, :title, :description)";
134 ':guid' => (int)
$guid,
154 if (!parent::update()) {
161 UPDATE {$dbprefix}objects_entity
163 description = :description
169 ':title' => (string) $this->
title,
187 $this->
title = $displayName;
212 return array_merge(parent::getExportableValues(), array(
if(! $site) if(!($site instanceof ElggSite)) $site description
elgg input elgg input elgg input tags
$user_guid
Avatar remove action.
getDatabase()
Provides a pointer to the database object.
getContainerEntity()
Get the container entity for this object.
loadAdditionalSelectValues(array $data)
Stores non-attributes from the loading of the entity as volatile data.
canWriteToContainer($user_guid=0, $type='all', $subtype='all')
Can a user add an entity to this container.
initializeAttributes()
Initialize the attributes array to include the type, title, and description.
static getExternalAttributes()
Get default values for attributes stored in a separate table.
getDisplayName()
{Get the entity's display name.string The title or name of this entity.}
prepareObject($object)
{Prepare an object copy for toObject()Object representation of the entity \stdClass}
update()
{Update the entity in the database.bool Whether the update was successful.}
canComment($user_guid=0, $default=null)
Can a user comment on this object?
setDisplayName($displayName)
{Sets the title or name of this entity.The title or name of this entity. void}
getExportableValues()
Return an array of fields which can be exported.
load($guid)
Loads the full \ElggObject when given a guid.
create()
{Create a new entry in the entities table.Saves the base information in the entities table for the en...
__construct($row=null)
Create a new \ElggObject.
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
$guid
Removes an admin notice.
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
_elgg_services(\Elgg\Di\ServiceProvider $services=null)
Get the global service provider.
elgg_instanceof($entity, $type=null, $subtype=null, $class=null)
Checks if $entity is an \ElggEntity and optionally for type and subtype.
$object
These two snippets demonstrates triggering an event and how to register for that event.
if($categories) $description