Image of a mountain
The most advanced REST web service for TYPO3 CMS.
Scroll to content

Document Storage

The Document Storage is an experimental store for objects of class \Cundd\Rest\Domain\Model\Document.


The database is the name of a collection of Documents. It has to be an alphanumeric, lowercase string. This string is saved with each Document and enables you to list, count, or remove all Documents of the given database.


The Document class is a flexible, schema-less object. It's (required) core properties are an ID and the name of the connected database. All other properties can be dynamically set and retrieved through key-value-coding methods:

Get the value for a key:


Get the value for a key path (i.e. ""):


Set the value for a key:

$document->setValueForKey($key, $value)


The object's ID is it's unique identifier inside the database.

Setting the ID:


Retrieving the ID:



The accessor methods for the database property contain a leading underscore to prevent them from accidentally being overwritten in subclasses

Setting the database:


Retrieving the database:



A Document's global unique identifier (GUID) can only exist once in the whole system. It is a combination of the Document's database and it's ID

public function getGuid() {
    $guid = $this->db . '-' . $this->id;
    return $guid !== '-' ? $guid : NULL;

There is no setter method for the GUID, but it can be retrieved through:



The documents are collected in the DocumentRepository (\Cundd\Rest\Domain\Repository\DocumentRepository) which can be used much like other Extbase repositories. Nevertheless you have to keep some things in mind:

Setting the database

When managing Documents the repository has to know which database the current Document belongs to. You can provide this information either by setting the current database in the repository or by setting a single Document's database.

Setting the repository's database:


Setting the Document's database (as seen above):


If a Document has the database set, this will be used instead of the repository's current database. If the Document's database isn't already set, the repository takes it's current database and copies it to the Document.

Finding Documents

Find an object by it's GUID:


Find all Documents in one database:


Search for Documents matching the given dictionary (associative array) of property keys and values:

$documentRepository->findWithProperties($properties, $count, $limit)

Find all Documents ignoring their database:


Managing Documents

Adding an object:


Updating an object:


Removing an object:


Remove all Documents from one database:


The register() method is a shorthand for: Object exists? Yes -> update / No -> add