Elgg  Version 4.x
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Elgg\Database\AnnotationsTable Class Reference

Interfaces with the database to perform CRUD operations on annotations. More...

Public Member Functions

 __construct (Database $db, EventsService $events)
 Constructor. More...
 
 get (int $id)
 Get a specific annotation by its id. More...
 
 delete (\ElggAnnotation $annotation)
 Deletes an annotation using its ID. More...
 
 create (\ElggAnnotation $annotation,\ElggEntity $entity)
 Create a new annotation and return its ID. More...
 
 update (\ElggAnnotation $annotation)
 Store updated annotation in the database. More...
 
 disable (\ElggAnnotation $annotation)
 Disable the annotation. More...
 
 enable (\ElggAnnotation $annotation)
 Enable the annotation. More...
 
 find (array $options=[])
 Returns annotations. More...
 
 deleteAll (array $options)
 Deletes annotations based on $options. More...
 
 disableAll (array $options)
 Disables annotations based on $options. More...
 
 enableAll (array $options)
 Enables annotations based on $options. More...
 
 exists (int $entity_guid, string $name, int $owner_guid)
 Check to see if a user has already created an annotation on an object. More...
 

Protected Member Functions

 isValidOptionsForBatchOperation (array $options)
 Checks if there are some constraints on the options array for potentially dangerous operations. More...
 

Protected Attributes

 $db
 
 $events
 

Detailed Description

Interfaces with the database to perform CRUD operations on annotations.

Definition at line 15 of file AnnotationsTable.php.

Constructor & Destructor Documentation

Elgg\Database\AnnotationsTable::__construct ( Database  $db,
EventsService  $events 
)

Constructor.

Parameters
Database$dbDatabase
EventsService$eventsEvents

Definition at line 35 of file AnnotationsTable.php.

Member Function Documentation

Elgg\Database\AnnotationsTable::create ( \ElggAnnotation  $annotation,
\ElggEntity  $entity 
)

Create a new annotation and return its ID.

Parameters
\ElggAnnotation$annotationAnnotation
\ElggEntity$entityEntity being annotated
Returns
int|bool

Definition at line 101 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::delete ( \ElggAnnotation  $annotation)

Deletes an annotation using its ID.

Parameters
\ElggAnnotation$annotationAnnotation
Returns
bool

Definition at line 70 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::deleteAll ( array  $options)

Deletes annotations based on $options.

Warning
Unlike elgg_get_annotations() this will not accept an empty options array! This requires at least one constraint: annotation_owner_guid(s), annotation_name(s), annotation_value(s), or guid(s) must be set.
See also
elgg_get_annotations()
elgg_get_entities()
Parameters
array$optionsOptions
Returns
bool|null true on success, false on failure, null if no annotations to delete.

Definition at line 295 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::disable ( \ElggAnnotation  $annotation)

Disable the annotation.

Parameters
\ElggAnnotation$annotationAnnotation
Returns
bool
Since
1.8

Definition at line 201 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::disableAll ( array  $options)

Disables annotations based on $options.

Warning
Unlike elgg_get_annotations() this will not accept an empty options array!
Parameters
array$optionsAn options array. elgg_get_annotations()
Returns
bool|null true on success, false on failure, null if no annotations disabled.

Definition at line 329 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::enable ( \ElggAnnotation  $annotation)

Enable the annotation.

Parameters
\ElggAnnotation$annotationAnnotation
Returns
bool
Since
1.8

Definition at line 237 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::enableAll ( array  $options)

Enables annotations based on $options.

Warning
Unlike elgg_get_annotations() this will not accept an empty options array!
Parameters
array$optionsAn options array. elgg_get_annotations()
Returns
bool|null true on success, false on failure, null if no metadata enabled.

Definition at line 367 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::exists ( int  $entity_guid,
string  $name,
int  $owner_guid 
)

Check to see if a user has already created an annotation on an object.

Parameters
int$entity_guidEntity guid
string$nameAnnotation name
int$owner_guidOwner guid
Returns
bool

Definition at line 426 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::find ( array  $options = [])

Returns annotations.

Accepts all elgg_get_entities() options

See also
elgg_get_entities()
Parameters
array$optionsOptions
Returns
[]|mixed

Definition at line 274 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::get ( int  $id)

Get a specific annotation by its id.

Parameters
int$idThe id of the annotation object
Returns
|false

Definition at line 47 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::isValidOptionsForBatchOperation ( array  $options)
protected

Checks if there are some constraints on the options array for potentially dangerous operations.

Parameters
array$optionsoptions to check
Returns
bool

Definition at line 399 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::update ( \ElggAnnotation  $annotation)

Store updated annotation in the database.

Parameters
\ElggAnnotation$annotationAnnotation to store
Returns
bool

Definition at line 164 of file AnnotationsTable.php.

Member Data Documentation

Elgg\Database\AnnotationsTable::$db
protected

Definition at line 22 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::$events
protected

Definition at line 27 of file AnnotationsTable.php.


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