Elgg  Version 5.1
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

Database $db
 
EventsService $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 29 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 91 of file AnnotationsTable.php.

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

Deletes an annotation using its ID.

Parameters
\ElggAnnotation$annotationAnnotation
Returns
bool

Definition at line 60 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 true on success, false on failure

Definition at line 289 of file AnnotationsTable.php.

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

Disable the annotation.

Parameters
\ElggAnnotation$annotationAnnotation
Returns
bool
Since
1.8

Definition at line 195 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 true on success, false on failure

Definition at line 323 of file AnnotationsTable.php.

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

Enable the annotation.

Parameters
\ElggAnnotation$annotationAnnotation
Returns
bool
Since
1.8

Definition at line 231 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 true on success, false on failure

Definition at line 361 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 420 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 268 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
|null

Definition at line 41 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 393 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 154 of file AnnotationsTable.php.

Member Data Documentation

Database Elgg\Database\AnnotationsTable::$db
protected

Definition at line 19 of file AnnotationsTable.php.

EventsService Elgg\Database\AnnotationsTable::$events
protected

Definition at line 21 of file AnnotationsTable.php.


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