Reference Store

The reference-store is a service which collects ids of entities/documents which are used to render a page. This ids will be used for example in the caching component HttpCacheBundle.


Each type of content registers its own service which implements the ReferenceStoreInterface or with the default implementation Sulu\Bundle\PageBundle\ReferenceStore\ReferenceStore.

The service sulu_website.reference_store_pool collects the services with the tag sulu_website.reference_store and use the alias attribute to identify them.

To register a loaded entity use the concrete store (e.g. sulu_page.reference_store.content or your own service) and call the method add to append the id of the entity.


<service id="app.reference_store.example"
    <tag name="sulu_website.reference_store" alias="example"/>
$exampleReferenceStore = $container->get('app.reference_store.example');

$referenceStore = $container->get('sulu_website.reference_store');

// prints
// array(1) {
//   [0] =>
//   int(1)
// }