diff --git a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php index 85f2ab7fe36..69f197bd3a1 100644 --- a/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php +++ b/code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php @@ -3,6 +3,8 @@ namespace App\Command; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Iterator\BatchIterator; +use Ibexa\Contracts\Core\Repository\Iterator\BatchIteratorAdapter\RelationListIteratorAdapter; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\ObjectStateService; use Ibexa\Contracts\Core\Repository\PermissionResolver; @@ -91,9 +93,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int // Relations $versionInfo = $this->contentService->loadVersionInfo($contentInfo); - $relationCount = $this->contentService->countRelations($versionInfo); - $relationList = $this->contentService->loadRelationList($versionInfo, 0, $relationCount); - foreach ($relationList as $relationListItem) { + $relationListIterator = new BatchIterator( + new RelationListIteratorAdapter( + $this->contentService, + $versionInfo + ) + ); + foreach ($relationListIterator as $relationListItem) { $name = $relationListItem->hasRelation() ? $relationListItem->getRelation()->destinationContentInfo->name : '(Unauthorized)'; $output->writeln("Relation to content '$name'"); } diff --git a/code_samples/front/embed_content/src/Controller/RelationController.php b/code_samples/front/embed_content/src/Controller/RelationController.php index eb6ef869038..58dc2d4af73 100644 --- a/code_samples/front/embed_content/src/Controller/RelationController.php +++ b/code_samples/front/embed_content/src/Controller/RelationController.php @@ -3,6 +3,8 @@ namespace App\Controller; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Iterator\BatchIterator; +use Ibexa\Contracts\Core\Repository\Iterator\BatchIteratorAdapter\RelationListIteratorAdapter; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Core\MVC\Symfony\View\View; @@ -21,11 +23,16 @@ public function showContentAction(View $view, $locationId): View $location = $this->locationService->loadLocation($locationId); $contentInfo = $location->getContentInfo(); $versionInfo = $this->contentService->loadVersionInfo($contentInfo); - $relationList = $this->contentService->loadRelationList($versionInfo); + $relationListIterator = new BatchIterator( + new RelationListIteratorAdapter( + $this->contentService, + $versionInfo + ) + ); $items = []; - foreach ($relationList as $relationListItem) { + foreach ($relationListIterator as $relationListItem) { if ($relationListItem->hasRelation() && in_array($relationListItem->getRelation()->getDestinationContentInfo()->getContentType()->identifier, $acceptedContentTypes)) { $items[] = $this->contentService->loadContentByContentInfo($relationListItem->getRelation()->getDestinationContentInfo()); } diff --git a/docs/content_management/content_api/browsing_content.md b/docs/content_management/content_api/browsing_content.md index a259b47ac05..5f726dd949a 100644 --- a/docs/content_management/content_api/browsing_content.md +++ b/docs/content_management/content_api/browsing_content.md @@ -25,16 +25,18 @@ This value object provides primitive fields, such as `contentTypeId`, `published You can also use it to request other content-related value objects from various services: -``` php hl_lines="14" -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 0, 5) =]] -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 21, 23) =]] -// ... - -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 42, 44) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 50, 58) =]] -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 113, 116) =]] +``` php hl_lines="13" +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 1, 5) =]] + +// … +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 24, 25) =]] + // … +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 45, 46) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 53, 60) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 119) =]] ``` -`ContentInfo` is loaded from the [`ContentService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html) (line 8). +`ContentInfo` is loaded from the [`ContentService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html) (line 13). It provides you with basic content metadata such as modification and publication dates or main language code. !!! note "Retrieving content information in a controller" @@ -46,7 +48,8 @@ It provides you with basic content metadata such as modification and publication To get the locations of a content item you need to make use of the [`LocationService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html): ``` php -[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 56, 61, remove_indent=True) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 63, 66, remove_indent=True) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 69, 69, remove_indent=True) =]] ``` [`LocationService::loadLocations`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_loadLocations) uses `ContentInfo` to get all the locations of a content item. @@ -60,7 +63,8 @@ The [`URLAliasService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-C [`URLAliasService::reverseLookup`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-URLAliasService.html#method_reverseLookup) gets the location's main [URL alias](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-URLAlias.html): ``` php -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 73, 76) =]][[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 77, 80) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 63, 65, remove_indent=True) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 67, 69, remove_indent=True) =]] ``` ### Content type @@ -68,7 +72,7 @@ The [`URLAliasService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-C You can retrieve the content type of a content item through the [`getContentType`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html#method_getContentType) method of the ContentInfo object: ``` php -[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 70, 71, remove_indent=True) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 72, 73, remove_indent=True) =]] ``` ### Versions @@ -76,13 +80,13 @@ You can retrieve the content type of a content item through the [`getContentType To iterate over the versions of a content item, use the [`ContentService::loadVersions`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadVersions) method, which returns an array of `VersionInfo` value objects. ``` php -[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 74, 79, remove_indent=True) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 76, 81, remove_indent=True) =]] ``` You can additionally provide the `loadVersions` method with the version status to get only versions of a specific status, for example: ``` php -[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 81, 81, remove_indent=True) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 83, 83, remove_indent=True) =]] ``` !!! note @@ -93,12 +97,18 @@ You can additionally provide the `loadVersions` method with the version status t ### Relations Content Relations are versioned. -To list Relations to and from your content, you need to pass a `VersionInfo` object to the [`ContentService::loadRelationList`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelationList) method. -This method loads only the specified subset of relations to improve performance and was created with pagination in mind. +To list Relations to and from your content, you can: + +- pass a `VersionInfo` object to the [`ContentService::loadRelationList` method](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelationList) which returns a slice of the relation list thanks to pagination arguments +- use the [`RelationListIteratorAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html) + within a [`BatchIterator`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIterator.html) which allow traversing the whole relation list + +See [Processing large result sets](search_api.md#process-large-result-sets) for more information about the `BatchIterator`. + You can get the current version's `VersionInfo` using [`ContentService::loadVersionInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadVersionInfo). ``` php -[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 93, 99, remove_indent=True) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 95, 105, remove_indent=True) =]] ``` You can also specify the version number as the second argument to get Relations for a specific version: @@ -121,7 +131,7 @@ It also holds the [relation type](content_relations.md), and the optional field You can use the `getOwner` method of the `ContentInfo` object to load the content item's owner as a `User` value object. ``` php -[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 102, 102, remove_indent=True) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 108, 108, remove_indent=True) =]] ``` To get the creator of the current version and not the content item's owner, you need to use the `creatorId` property from the current version's `VersionInfo` object. @@ -131,7 +141,7 @@ To get the creator of the current version and not the content item's owner, you You can find the section to which a content item belongs through the [`getSection`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-ContentInfo.html#method_getSection) method of the ContentInfo object: ``` php -[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 105, 105, remove_indent=True) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 111, 111, remove_indent=True) =]] ``` !!! note @@ -146,26 +156,27 @@ You need to provide it with the object state group. All object state groups can be retrieved through [`loadObjectStateGroups`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ObjectStateService.html#method_loadObjectStateGroups). ``` php -[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 108, 112, remove_indent=True) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 114, 118, remove_indent=True) =]] ``` -## Viewing content with fields +## Viewing field definitions of content types -To retrieve the fields of the selected content item, you can use the following command: +To retrieve the content type's field definitions of a selected content item, you can use the following command: ``` php hl_lines="17-18 20-27" -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentCommand.php', 0, 7) =]] -// ... -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentCommand.php', 17, 19) =]] -[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentCommand.php', 35, 54) =]] +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentCommand.php', 1, 7) =]] +// … +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentCommand.php', 18, 19) =]] + // … +[[= include_code('code_samples/api/public_php_api/src/Command/ViewContentCommand.php', 36) =]] ``` -Line 9 shows how [`ContentService::loadContent`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadContent) loads the content item provided to the command. -Line 10 makes use of the [`ContentTypeService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentTypeService.html) to retrieve the content type of the requested item. +Line 17 shows how [`ContentService::loadContent`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadContent) loads the content item provided to the command. +Line 18 makes use of the [`ContentTypeService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentTypeService.html) to retrieve the content type of the requested item. -Lines 12-19 iterate over fields defined by the content type. -For each field they print out its identifier, and then using [`FieldTypeService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-FieldTypeService.html) retrieve the field's value and print it out to the console. +Lines 20-27 iterate over fields defined by the content type. +For each field definition they print out its identifier, and then using [`FieldTypeService`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-FieldTypeService.html) retrieve the field definition's value and print it out to the console. ## Viewing content in different languages diff --git a/docs/search/search_api.md b/docs/search/search_api.md index f7fb147280a..5ac34caf98b 100644 --- a/docs/search/search_api.md +++ b/docs/search/search_api.md @@ -125,19 +125,20 @@ foreach ($iterator as $result) { You can also define the batch size by setting `$iterator->setBatchSize()`. -The following BatchIterator adapters are available, for both `query` and `filter` searches: - -| Adapter | Method | -|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [`ContentFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentFilteringAdapter.html) | [`Ibexa\Contracts\Core\Repository\ContentService::find`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_find) | -| [`ContentInfoSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentInfoSearchAdapter.html) | [`Ibexa\Contracts\Core\Repository\SearchService::findContentInfo`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContentInfo) | -| [`ContentSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentSearchAdapter.html) | [`Ibexa\Contracts\Core\Repository\SearchService::findContent`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContent) | -| [`LocationFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-LocationFilteringAdapter.html) | [`Ibexa\Contracts\Core\Repository\LocationService::find`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_find) | -| [`LocationSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-LocationSearchAdapter.html) | [`Ibexa\Contracts\Core\Repository\SearchService::findLocations`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findLocations) | -| [`AttributeDefinitionFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-AttributeDefinitionFetchAdapter.html) | [`Ibexa\Contracts\ProductCatalog\AttributeDefinitionServiceInterface::findAttributesDefinitions`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeDefinitionServiceInterface.html#method_findAttributesDefinitions) | -| [`AttributeGroupFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-AttributeGroupFetchAdapter.html) | [`Ibexa\Contracts\ProductCatalog\AttributeGroupServiceInterface::findAttributeGroups`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeGroupServiceInterface.html#method_findAttributeGroups) | -| [`CurrencyFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-CurrencyFetchAdapter.html) | [`Ibexa\Contracts\ProductCatalog\CurrencyServiceInterface::findCurrencies`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-CurrencyServiceInterface.html#method_findCurrencies) | -| [`ProductTypeListAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-ProductTypeListAdapter.html) | [`Ibexa\Contracts\ProductCatalog\ProductTypeServiceInterface::findProductTypes`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-ProductTypeServiceInterface.html#method_findProductTypes) | +The following BatchIterator adapters are available, for both `query` and `filter` searches, here with the method they replace: + +| Adapter | Regular method | +|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [`ContentFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentFilteringAdapter.html) | [`ContentService::find()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_find) | +| [`ContentInfoSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentInfoSearchAdapter.html) | [`SearchService::findContentInfo()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContentInfo) | +| [`ContentSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-ContentSearchAdapter.html) | [`SearchService::findContent()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findContent) | +| [`RelationListIteratorAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-RelationListIteratorAdapter.html) | [`ContentService::loadRelationList()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelationList) | +| [`LocationFilteringAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-LocationFilteringAdapter.html) | [`LocationService::find()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-LocationService.html#method_find) | +| [`LocationSearchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Iterator-BatchIteratorAdapter-LocationSearchAdapter.html) | [`SearchService::findLocations()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findLocations) | +| [`AttributeDefinitionFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-AttributeDefinitionFetchAdapter.html) | [`AttributeDefinitionServiceInterface::findAttributesDefinitions()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeDefinitionServiceInterface.html#method_findAttributesDefinitions) | +| [`AttributeGroupFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-AttributeGroupFetchAdapter.html) | [`AttributeGroupServiceInterface::findAttributeGroups()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-AttributeGroupServiceInterface.html#method_findAttributeGroups) | +| [`CurrencyFetchAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-CurrencyFetchAdapter.html) | [`CurrencyServiceInterface::findCurrencies()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-CurrencyServiceInterface.html#method_findCurrencies) | +| [`ProductTypeListAdapter`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Iterator-BatchIteratorAdapter-ProductTypeListAdapter.html) | [`ProductTypeServiceInterface::findProductTypes()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-ProductTypeServiceInterface.html#method_findProductTypes) | ## Repository filtering diff --git a/docs/templating/embed_and_list_content/embed_content.md b/docs/templating/embed_and_list_content/embed_content.md index b27e445fbe4..0398a1bf6da 100644 --- a/docs/templating/embed_and_list_content/embed_content.md +++ b/docs/templating/embed_and_list_content/embed_content.md @@ -36,13 +36,13 @@ You can use a custom controller for any situation where Query types aren't suffi This configuration points to a custom `RelationController` that should render all Articles with the `showContentAction()` method. -``` php hl_lines="23 27 28" +``` php hl_lines="21 26-31" [[= include_code('code_samples/front/embed_content/src/Controller/RelationController.php') =]] ``` -This controller uses the Public PHP API to get [the Relations of a content item](browsing_content.md#relations) (lines 27-28). +This controller uses the Public PHP API to get [the relations of a content item](browsing_content.md#relations) (lines 26-31). -The controller takes the custom parameter called `accepted_content_types` (line 23), which is an array of content type identifiers that are rendered. +The controller takes the custom parameter called `accepted_content_types` (line 21), which is an array of content type identifiers that are rendered. This way you can control which content types you want to show or exclude. diff --git a/docs/templating/queries_and_controllers/controllers.md b/docs/templating/queries_and_controllers/controllers.md index da8c2ebe239..22d063de9f8 100644 --- a/docs/templating/queries_and_controllers/controllers.md +++ b/docs/templating/queries_and_controllers/controllers.md @@ -13,7 +13,11 @@ You indicate which controller to use in the [content view configuration](templat ``` ``` php -[[= include_file('code_samples/front/embed_content/src/Controller/RelationController.php', 0, 10) =]][[= include_file('code_samples/front/embed_content/src/Controller/RelationController.php', 16, 18) =]][[= include_file('code_samples/front/embed_content/src/Controller/RelationController.php', 37, 40) =]] +[[= include_code('code_samples/front/embed_content/src/Controller/RelationController.php', 1, 5) =]] +[[= include_code('code_samples/front/embed_content/src/Controller/RelationController.php', 8, 9) =]] +[[= include_code('code_samples/front/embed_content/src/Controller/RelationController.php', 10, 12) =]] +[[= include_code('code_samples/front/embed_content/src/Controller/RelationController.php', 19, 20) =]] +[[= include_code('code_samples/front/embed_content/src/Controller/RelationController.php', 45) =]] ``` For a full example of using a custom controller, see [Embed content](embed_content.md#embed-relations-with-a-custom-controller).