Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions code_samples/cache/http_cache/src/response_tagging.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php declare(strict_types=1);

/** @var \Ibexa\Contracts\HttpCache\ResponseTagger\ResponseTagger $responseTagger */
/** @var \Ibexa\Core\MVC\Symfony\View\ContentValueView|\Ibexa\Core\MVC\Symfony\View\LocationValueView $view */
$responseTagger->tag($view); // When working with a view

/** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */
$responseTagger->tag($content->getContentInfo()); // When working with a content item

/** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */
$responseTagger->tag($location); // When working with a location
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@
For example, a `ContentView` is covered both by the `ContentValueViewTagger` and `LocationValueViewTagger`, where the first extracts the content from the `ContentView` and passes it to the `ContentInfoTagger`.
- Value taggers - extract the `Location` and pass it on to the `LocationViewTagger`.

The built-in taggers support the following value types:

- [`ContentInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html)
- [`Location`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Location.html)
- Any view implementing `Ibexa\Core\MVC\Symfony\View\ContentValueView`
- Any view implementing `Ibexa\Core\MVC\Symfony\View\LocationValueView`

Check notice on line 148 in docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md#L148

[Ibexa.Lists] Verify list formatting: Full sentences should start with uppercase and end with a period. Sentence fragments should start with lowercase and have no period.
Raw output
{"message": "[Ibexa.Lists] Verify list formatting: Full sentences should start with uppercase and end with a period. Sentence fragments should start with lowercase and have no period.", "location": {"path": "docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md", "range": {"start": {"line": 148, "column": 1}}}, "severity": "INFO"}

!!! warning

If a value of any other type is passed (for example, a [`Content`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Content.html) object), no tagger matches and the call has no effect.

## DispatcherTagger

Accepts any value and passes it on to every tagger registered with the service tag `ibexa.cache.http.response.tagger`.
Expand All @@ -150,17 +161,10 @@

1\. Reusing `DispatcherTagger` to pick correct tags.

Examples for tagging everything needed for content using the autowireable `ResponseTagger` interface:

``` php
/** @var \Ibexa\Contracts\HttpCache\ResponseTagger\ResponseTagger $responseTagger */

// If you have a View object you can simply call:
$responseTagger->tag($view);
Examples for tagging everything needed for content using the autowireable [`ResponseTagger`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-HttpCache-ResponseTagger-ResponseTagger.html) interface:

Check notice on line 164 in docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md#L164

[Ibexa.ByUsing] Prefer 'by using' or 'with' to plain 'using'.
Raw output
{"message": "[Ibexa.ByUsing] Prefer 'by using' or 'with' to plain 'using'.", "location": {"path": "docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md", "range": {"start": {"line": 164, "column": 44}}}, "severity": "INFO"}

// Or if you have content / Location object only, you can instead provide content info and Location:
$responseTagger->tag($contentInfo);
$responseTagger->tag($location);
``` php hl_lines="3 6 9"
[[= include_file('code_samples/cache/http_cache/src/response_tagging.php', 2, 11) =]]
```

2\. Use `ContentTagInterface` API for content related tags.
Expand Down
Loading