8 use Elgg\Traits\TimeUsing;
45 $qb->addClause($where);
47 $row = $this->db->getDataRow(
$qb);
48 return !empty($row) ? new \ElggAnnotation($row) :
null;
63 if (!$this->events->trigger(
'delete',
'annotation',
$annotation)) {
91 return $this->
update($annotation);
107 if (!$this->events->triggerBefore(
'create',
'annotation',
$annotation)) {
132 if (!$this->events->trigger(
'create',
'annotation',
$annotation)) {
138 $this->events->triggerAfter(
'create',
'annotation',
$annotation);
161 if (!$this->events->triggerBefore(
'update',
'annotation',
$annotation)) {
179 $this->events->trigger(
'update',
'annotation',
$annotation);
180 $this->events->triggerAfter(
'update',
'annotation',
$annotation);
195 $options[
'metastring_type'] =
'annotations';
216 if (!$this->isValidOptionsForBatchOperation(
$options)) {
222 $options[
'batch_inc_offset'] =
false;
224 $annotations = Annotations::find(
$options);
225 $count = $annotations->count();
238 return $success ===
$count;
251 'annotation_owner_guid',
'annotation_owner_guids',
252 'annotation_name',
'annotation_names',
253 'annotation_value',
'annotation_values',
280 $qb = Select::fromTable(self::TABLE_NAME);
if(! $user||! $user->canDelete()) $name
$id
Generic annotation delete action.
elgg_delete_annotation_by_id(int $id)
Deletes an annotation using its ID.
Interfaces with the database to perform CRUD operations on annotations.
__construct(protected Database $db, protected EventsService $events)
Constructor.
deleteAll(array $options)
Deletes annotations based on $options.
find(array $options=[])
Returns annotations.
create(\ElggAnnotation $annotation, \ElggEntity $entity)
Create a new annotation and return its ID.
isValidOptionsForBatchOperation(array $options)
Checks if there are some constraints on the options array for potentially dangerous operations.
update(\ElggAnnotation $annotation)
Store updated annotation in the database.
exists(int $entity_guid, string $name, int $owner_guid)
Check to see if a user has already created an annotation on an object.
Builds queries for matching annotations against their properties.
static fromTable(string $table)
Returns a QueryBuilder for deleting data from a given table.
static intoTable(string $table)
Returns a QueryBuilder for inserting data in a given table.
static fromTable(string $table, ?string $alias=null)
Returns a QueryBuilder for selecting data from a given table.
static table(string $table)
Returns a QueryBuilder for updating data in a given table.
const ELGG_VALUE_INTEGER
Value types.
if($who_can_change_language==='nobody') elseif($who_can_change_language==='admin_only' &&!elgg_is_admin_logged_in()) $options
if(! $user instanceof \ElggUser) $time_created
foreach($recommendedExtensions as $extension) if(empty(ini_get('session.gc_probability'))||empty(ini_get('session.gc_divisor'))) $db
if($container instanceof ElggGroup && $container->guid !=elgg_get_page_owner_guid()) $key
elgg_delete_river(array $options=[])
Delete river items based on $options.
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.