Elgg  Version 3.0
Public 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 ($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 ($entity_guid, $name, $owner_guid)
 Check to see if a user has already created an annotation on an object. More...
 

Protected Attributes

 $db
 
 $events
 

Detailed Description

Interfaces with the database to perform CRUD operations on annotations.

WARNING: API IN FLUX. DO NOT USE DIRECTLY.

Definition at line 18 of file AnnotationsTable.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
Database$dbDatabase
EventsService$eventsEvents

Definition at line 38 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 104 of file AnnotationsTable.php.

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

Deletes an annotation using its ID.

Parameters
ElggAnnotation$annotationAnnotation
Returns
bool

Definition at line 73 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 298 of file AnnotationsTable.php.

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

Disable the annotation.

Parameters
ElggAnnotation$annotationAnnotation
Returns
bool
Since
1.8

Definition at line 204 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 332 of file AnnotationsTable.php.

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

Enable the annotation.

Parameters
ElggAnnotation$annotationAnnotation
Returns
bool
Since
1.8

Definition at line 240 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!
In order to enable annotations, you must first use access_show_hidden_entities().
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 373 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::exists (   $entity_guid,
  $name,
  $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 407 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
ElggAnnotation[]|mixed

Definition at line 277 of file AnnotationsTable.php.

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

Get a specific annotation by its id.

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

Definition at line 50 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 167 of file AnnotationsTable.php.

Member Data Documentation

Elgg\Database\AnnotationsTable::$db
protected

Definition at line 25 of file AnnotationsTable.php.

Elgg\Database\AnnotationsTable::$events
protected

Definition at line 30 of file AnnotationsTable.php.


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