Elgg
Version master
|
This class interfaces with the database to perform CRUD operations on metadata. More...
Public Member Functions | |
__construct (protected AccessCache $access_cache, protected MetadataCache $metadata_cache, protected Database $db, protected Events $events, protected EntityTable $entityTable) | |
Constructor. More... | |
getTags (array $options=[]) | |
Get popular tags and their frequencies. More... | |
get (int $id) | |
Get a specific metadata object by its id. More... | |
delete (\ElggMetadata $metadata) | |
Deletes metadata using its ID. More... | |
create (\ElggMetadata $metadata, bool $allow_multiple=false) | |
Create a new metadata object, or update an existing one (if multiple is allowed) More... | |
update (\ElggMetadata $metadata) | |
Update a specific piece of metadata. More... | |
getAll (array $options=[]) | |
Returns metadata. More... | |
getRowsForGuids (array $guids) | |
Returns metadata rows. More... | |
deleteAll (array $options) | |
Deletes metadata based on $options. More... | |
getIDsByName (int $entity_guid, string $name) | |
Returns ID(s) of metadata with a particular name attached to an entity. More... | |
Public Attributes | |
const | TABLE_NAME = 'metadata' |
const | DEFAULT_JOIN_ALIAS = 'n_table' |
This class interfaces with the database to perform CRUD operations on metadata.
Definition at line 20 of file MetadataTable.php.
Elgg\Database\MetadataTable::__construct | ( | protected AccessCache | $access_cache, |
protected MetadataCache | $metadata_cache, | ||
protected Database | $db, | ||
protected Events | $events, | ||
protected EntityTable | $entityTable | ||
) |
Constructor.
AccessCache | $access_cache | The access cache |
MetadataCache | $metadata_cache | A cache for this table |
Database | $db | The Elgg database |
Events | $events | The events registry |
EntityTable | $entityTable | The EntityTable database wrapper |
Definition at line 37 of file MetadataTable.php.
Elgg\Database\MetadataTable::create | ( | \ElggMetadata | $metadata, |
bool | $allow_multiple = false |
||
) |
Create a new metadata object, or update an existing one (if multiple is allowed)
Metadata can be an array by setting allow_multiple to true, but it is an indexed array with no control over the indexing
\ElggMetadata | $metadata | Metadata |
bool | $allow_multiple | Allow multiple values for one key. Default is false |
LogicException |
Definition at line 190 of file MetadataTable.php.
Elgg\Database\MetadataTable::delete | ( | \ElggMetadata | $metadata | ) |
Deletes metadata using its ID.
\ElggMetadata | $metadata | Metadata |
Definition at line 157 of file MetadataTable.php.
Elgg\Database\MetadataTable::deleteAll | ( | array | $options | ) |
Deletes metadata based on $options.
array | $options | Options |
InvalidArgumentException |
Definition at line 362 of file MetadataTable.php.
Elgg\Database\MetadataTable::get | ( | int | $id | ) |
Get a specific metadata object by its id.
int | $id | The id of the metadata object being retrieved. |
Definition at line 138 of file MetadataTable.php.
Elgg\Database\MetadataTable::getAll | ( | array | $options = [] | ) |
Returns metadata.
Accepts all elgg_get_entities() options for entity restraints.
array | $options | Options |
Definition at line 316 of file MetadataTable.php.
Elgg\Database\MetadataTable::getIDsByName | ( | int | $entity_guid, |
string | $name | ||
) |
Returns ID(s) of metadata with a particular name attached to an entity.
Definition at line 422 of file MetadataTable.php.
Elgg\Database\MetadataTable::getRowsForGuids | ( | array | $guids | ) |
Returns metadata rows.
Used internally for metadata preloading
array | $guids | Array of guids to fetch metadata rows for |
Definition at line 334 of file MetadataTable.php.
Elgg\Database\MetadataTable::getTags | ( | array | $options = [] | ) |
Get popular tags and their frequencies.
Accepts all options supported by {
Returns an array of objects that include "tag" and "total" properties
array | $options | Options |
int $threshold Minimum number of tag occurrences string[] $tag_names tag names to include in search
Definition at line 60 of file MetadataTable.php.
Elgg\Database\MetadataTable::update | ( | \ElggMetadata | $metadata | ) |
Update a specific piece of metadata.
\ElggMetadata | $metadata | Updated metadata |
Definition at line 275 of file MetadataTable.php.
const Elgg\Database\MetadataTable::DEFAULT_JOIN_ALIAS = 'n_table' |
Definition at line 26 of file MetadataTable.php.
const Elgg\Database\MetadataTable::TABLE_NAME = 'metadata' |
Definition at line 24 of file MetadataTable.php.