Quasardb API for PHP
Introduction Installation Compilation Configuration API Reference

Namespaces

  • qdb

Classes

  • QdbAliasAlreadyExistsException
  • QdbAliasNotFoundException
  • QdbBatch
  • QdbBatchResult
  • QdbBlob
  • QdbCluster
  • QdbConnectionException
  • QdbContainerEmptyException
  • QdbDeque
  • QdbEntry
  • QdbEntryCollection
  • QdbException
  • QdbExpirableEntry
  • QdbIncompatibleTypeException
  • QdbInputException
  • QdbInteger
  • QdbOperationDisabledException
  • QdbOperationException
  • QdbProtocolException
  • QdbSystemException
  • QdbTag
  • QdbTagCollection

Class QdbTag

A tag in the database.

A tag is a lightweight means of finding entries in the database.

qdb\QdbEntry
Extended by qdb\QdbTag
Namespace: qdb
Example:

You get a QdbTag instance by calling \QdbCluster::tag(). Then enumerate entry having this tag:

$users = $cluster->tag('user')->getEntries();
foreach ($user as $user) {
    echo($user->alias());
}

Methods summary
public boolean
# attachEntry( qdb\QdbEntry|string $entry )

Attaches the tag to an entry.

Attaches the tag to an entry.

Parameters

$entry
The entry to add the tag to, or its alias.

Returns

boolean
true if the tag was added, or false it the entry already had this tag.

Throws

qdb\QdbIncompatibleTypeException

Example

$cluster->tag('male')->attachEntry('Bob the Blob');
// same as $cluster->blob('Bob the Blob')->attachTag('male');

public qdb\QdbEntryCollection
# getEntries( )

Enumerates tagged entries.

Enumerates tagged entries.

Returns

qdb\QdbEntryCollection
A traversable collection of qdb\QdbEntry.

Throws

qdb\QdbIncompatibleTypeException

Example

$males = $cluster->tag('male')->getEntries();
foreach ($males as $entry) {
    echo($entry->alias() . ' is a male');
}

public boolean
# hasEntry( qdb\QdbEntry|string $entry )

Checks if an entry is attached with the tag.

Checks if an entry is attached with the tag.

Parameters

$entry
The entry to check, or its alias.

Returns

boolean
true if the entry is tagged with the given tag, false otherwise.

Example

$bob_is_male = $cluster->tag('male')->hasEntry('Bob the Blob');
// same as $bob_is_male = $cluster->blob('Bob the Blob')->hasTag('male');

public boolean
# detachEntry( qdb\QdbEntry|string $entry )

Detachs the tag from an entry.

Detachs the tag from an entry.

Parameters

$entry
The entry to remove the tag from, or its alias.

Returns

boolean
true if the tag was removed, or false it the entry already didn't have this tag.

Throws

qdb\QdbIncompatibleTypeException

Example

$cluster->tag('stupid name')->detachEntry('Bob the Blob');
// same as $cluster->blob('Bob the Blob')->detachTag('stupid name');

Methods inherited from qdb\QdbEntry
alias(), attachTag(), attachTags(), detachTag(), getTags(), hasTag(), remove()
Copyright 2009-2018 quasardb SAS Documentation generated by ApiGen