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

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

Public Member Functions

 __construct (protected Database $db, protected 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...
 
 find (array $options=[])
 Returns annotations. More...
 
 deleteAll (array $options)
 Deletes 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...
 

Public Attributes

const TABLE_NAME = 'annotations'
 
const DEFAULT_JOIN_ALIAS = 'a_table'
 

Protected Member Functions

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

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 ( protected Database  $db,
protected 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 89 of file AnnotationsTable.php.

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

Deletes an annotation using its ID.

Parameters
\ElggAnnotation$annotationAnnotation
Returns
bool

Definition at line 58 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 215 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 275 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 194 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 39 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 248 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 152 of file AnnotationsTable.php.

Member Data Documentation

const Elgg\Database\AnnotationsTable::DEFAULT_JOIN_ALIAS = 'a_table'

Definition at line 21 of file AnnotationsTable.php.

const Elgg\Database\AnnotationsTable::TABLE_NAME = 'annotations'

Definition at line 19 of file AnnotationsTable.php.


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