Skip to content

Commit ca3be9d

Browse files
authored
Merge branch 'master' into enh-search-doc
2 parents a310045 + 7f22a70 commit ca3be9d

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5353
$user = $this->userService->loadUserByLogin('admin');
5454
$this->permissionResolver->setCurrentUserReference($user);
5555

56-
$contentId = $input->getArgument('contentId');
56+
$contentId = (int) $input->getArgument('contentId');
5757

5858
// Metadata
5959
$contentInfo = $this->contentService->loadContentInfo($contentId);
@@ -99,10 +99,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9999

100100
// Relations
101101
$versionInfo = $this->contentService->loadVersionInfo($contentInfo);
102-
$relations = $this->contentService->loadRelations($versionInfo);
103-
foreach ($relations as $relation) {
104-
$name = $relation->destinationContentInfo->name;
105-
$output->writeln('Relation to content ' . $name);
102+
$relationCount = $this->contentService->countRelations($versionInfo);
103+
$relationList = $this->contentService->loadRelationList($versionInfo, 0, $relationCount);
104+
foreach ($relationList as $relationListItem) {
105+
$name = $relationListItem->hasRelation() ? $relationListItem->getRelation()->destinationContentInfo->name : '(Unauthorized)';
106+
$output->writeln("Relation to content '$name'");
106107
}
107108

108109
// Owner

code_samples/front/embed_content/src/Controller/RelationController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ public function showContentAction(View $view, $locationId): View
2525
$location = $this->locationService->loadLocation($locationId);
2626
$contentInfo = $location->getContentInfo();
2727
$versionInfo = $this->contentService->loadVersionInfo($contentInfo);
28-
$relations = $this->contentService->loadRelations($versionInfo);
28+
$relationList = $this->contentService->loadRelationList($versionInfo);
2929

3030
$items = [];
3131

32-
foreach ($relations as $relation) {
33-
if (in_array($relation->getDestinationContentInfo()->getContentType()->identifier, $acceptedContentTypes)) {
34-
$items[] = $this->contentService->loadContentByContentInfo($relation->getDestinationContentInfo());
32+
foreach ($relationList as $relationListItem) {
33+
if ($relationListItem->hasRelation() && in_array($relationListItem->getRelation()->getDestinationContentInfo()->getContentType()->identifier, $acceptedContentTypes)) {
34+
$items[] = $this->contentService->loadContentByContentInfo($relationListItem->getRelation()->getDestinationContentInfo());
3535
}
3636
}
3737

docs/content_management/content_api/browsing_content.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ to get only versions of a specific status, e.g.:
103103

104104
Content Relations are versioned.
105105
To list Relations to and from your content,
106-
you need to pass a `VersionInfo` object to the [`ContentService::loadRelations`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_loadRelations) method.
106+
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.
107107
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).
108108

109109
``` php
110-
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 100, 106) =]]
110+
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 100, 107) =]]
111111
```
112112

113113
You can also specify the version number as the second argument to get Relations for a specific version:
@@ -116,7 +116,8 @@ You can also specify the version number as the second argument to get Relations
116116
$versionInfo = $this->contentService->loadVersionInfo($contentInfo, 2);
117117
```
118118

119-
`loadRelations` provides an array of [`Relation`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Relation.html) objects.
119+
`loadRelationList` provides an iterable [`RelationList`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-RelationList.html) object
120+
listing [`Relation`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Relation.html) objects.
120121
`Relation` has two main properties: `destinationContentInfo`, and `sourceContentInfo`.
121122
It also holds the [relation type](content_relations.md),
122123
and the optional Field this relation is made with.
@@ -126,7 +127,7 @@ and the optional Field this relation is made with.
126127
You can use the `getOwner` method of the `ContentInfo` object to load the content item's owner as a `User` value object.
127128

128129
``` php
129-
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 108, 109) =]]
130+
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 109, 110) =]]
130131
```
131132

132133
To get the creator of the current version and not the content item's owner,
@@ -139,7 +140,7 @@ the [`getSection`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-C
139140
of the ContentInfo object:
140141

141142
``` php
142-
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 111, 112) =]]
143+
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 112, 113) =]]
143144
```
144145

145146
!!! note
@@ -155,7 +156,7 @@ You need to provide it with the Object state group.
155156
All Object state groups can be retrieved through [`loadObjectStateGroups`](../../api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ObjectStateService.html#method_loadObjectStateGroups).
156157

157158
``` php
158-
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 114, 119) =]]
159+
[[= include_file('code_samples/api/public_php_api/src/Command/ViewContentMetaDataCommand.php', 115, 120) =]]
159160
```
160161

161162
## Viewing content with Fields

docs/infrastructure_and_maintenance/security/security_checklist.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ Use the following checklist to ensure the Roles and Policies are secure:
171171
- Is the Role of self-created new users restricted as intended?
172172
- Is there a clear Role separation between the organisation's internal and external users?
173173
- Is access to user data properly restricted, in accordance with GDPR?
174+
- Is access to Form Builder uploads managed properly? Files uploaded with the Form Builder are accessible to any user by default. If this doesn't suit you, restrict access to the Form Uploads folder.
174175

175176
### Do not use "hide" for read access restriction
176177

tools/code_samples/code_samples_usage_diff2html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
continue;
3434
}
3535
$statusChar = strlen($diffLine) ? $diffLine[0] : '';
36-
$realLine = $str = substr($diffLine, 1);
36+
$realLine = str_replace(['<', '>'], ['&lt;', '&gt;'], substr($diffLine, 1));
3737
if ($previousStatusChar !== $statusChar) {
3838
switch ("$previousStatusChar$statusChar") {
3939
case ' +':

0 commit comments

Comments
 (0)