Completed
Push — EZP-30968-count-reverse-relati... ( c55217 )
by
unknown
27:08 queued 08:53
created

ContentService::countReverseRelations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
cc 1
nc 1
nop 1
rs 10
1
<?php
2
3
/**
4
 * ContentService class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\Core\Repository\SiteAccessAware;
10
11
use eZ\Publish\API\Repository\ContentService as ContentServiceInterface;
12
use eZ\Publish\API\Repository\Values\Content\ContentCreateStruct;
13
use eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct;
14
use eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct;
15
use eZ\Publish\API\Repository\Values\Content\Language;
16
use eZ\Publish\API\Repository\Values\Content\LocationCreateStruct;
17
use eZ\Publish\API\Repository\Values\ContentType\ContentType;
18
use eZ\Publish\API\Repository\Values\User\User;
19
use eZ\Publish\API\Repository\Values\Content\VersionInfo;
20
use eZ\Publish\API\Repository\Values\Content\ContentInfo;
21
use eZ\Publish\API\Repository\LanguageResolver;
22
23
/**
24
 * SiteAccess aware implementation of ContentService injecting languages where needed.
25
 */
26
class ContentService implements ContentServiceInterface
27
{
28
    /** @var \eZ\Publish\API\Repository\ContentService */
29
    protected $service;
30
31
    /** @var \eZ\Publish\API\Repository\LanguageResolver */
32
    protected $languageResolver;
33
34
    /**
35
     * Construct service object from aggregated service and LanguageResolver.
36
     *
37
     * @param \eZ\Publish\API\Repository\ContentService $service
38
     * @param \eZ\Publish\API\Repository\LanguageResolver $languageResolver
39
     */
40
    public function __construct(
41
        ContentServiceInterface $service,
42
        LanguageResolver $languageResolver
43
    ) {
44
        $this->service = $service;
45
        $this->languageResolver = $languageResolver;
46
    }
47
48
    public function loadContentInfo($contentId)
49
    {
50
        return $this->service->loadContentInfo($contentId);
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function loadContentInfoList(array $contentIds): iterable
57
    {
58
        return $this->service->loadContentInfoList($contentIds);
59
    }
60
61
    public function loadContentInfoByRemoteId($remoteId)
62
    {
63
        return $this->service->loadContentInfoByRemoteId($remoteId);
64
    }
65
66
    public function loadVersionInfo(ContentInfo $contentInfo, $versionNo = null)
67
    {
68
        return $this->service->loadVersionInfo($contentInfo, $versionNo);
69
    }
70
71
    public function loadVersionInfoById($contentId, $versionNo = null)
72
    {
73
        return $this->service->loadVersionInfoById($contentId, $versionNo);
74
    }
75
76
    public function loadContentByContentInfo(ContentInfo $contentInfo, array $languages = null, $versionNo = null, $useAlwaysAvailable = null)
77
    {
78
        return $this->service->loadContentByContentInfo(
79
            $contentInfo,
80
            $this->languageResolver->getPrioritizedLanguages($languages),
81
            $versionNo,
82
            $this->languageResolver->getUseAlwaysAvailable($useAlwaysAvailable)
83
        );
84
    }
85
86
    public function loadContentByVersionInfo(VersionInfo $versionInfo, array $languages = null, $useAlwaysAvailable = null)
87
    {
88
        return $this->service->loadContentByVersionInfo(
89
            $versionInfo,
90
            $this->languageResolver->getPrioritizedLanguages($languages),
91
            $this->languageResolver->getUseAlwaysAvailable($useAlwaysAvailable)
92
        );
93
    }
94
95
    public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = null)
96
    {
97
        return $this->service->loadContent(
98
            $contentId,
99
            $this->languageResolver->getPrioritizedLanguages($languages),
100
            $versionNo,
101
            $this->languageResolver->getUseAlwaysAvailable($useAlwaysAvailable)
102
        );
103
    }
104
105
    public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = null)
106
    {
107
        return $this->service->loadContentByRemoteId(
108
            $remoteId,
109
            $this->languageResolver->getPrioritizedLanguages($languages),
110
            $versionNo,
111
            $this->languageResolver->getUseAlwaysAvailable($useAlwaysAvailable)
112
        );
113
    }
114
115
    public function createContent(ContentCreateStruct $contentCreateStruct, array $locationCreateStructs = [])
116
    {
117
        return $this->service->createContent($contentCreateStruct, $locationCreateStructs);
118
    }
119
120
    public function updateContentMetadata(ContentInfo $contentInfo, ContentMetadataUpdateStruct $contentMetadataUpdateStruct)
121
    {
122
        return $this->service->updateContentMetadata($contentInfo, $contentMetadataUpdateStruct);
123
    }
124
125
    public function deleteContent(ContentInfo $contentInfo)
126
    {
127
        return $this->service->deleteContent($contentInfo);
128
    }
129
130
    public function createContentDraft(ContentInfo $contentInfo, VersionInfo $versionInfo = null, User $user = null)
131
    {
132
        return $this->service->createContentDraft($contentInfo, $versionInfo, $user);
133
    }
134
135
    public function loadContentDrafts(User $user = null)
136
    {
137
        return $this->service->loadContentDrafts($user);
138
    }
139
140
    public function updateContent(VersionInfo $versionInfo, ContentUpdateStruct $contentUpdateStruct)
141
    {
142
        return $this->service->updateContent($versionInfo, $contentUpdateStruct);
143
    }
144
145
    public function publishVersion(VersionInfo $versionInfo, array $translations = Language::ALL)
146
    {
147
        return $this->service->publishVersion($versionInfo, $translations);
148
    }
149
150
    public function deleteVersion(VersionInfo $versionInfo)
151
    {
152
        return $this->service->deleteVersion($versionInfo);
153
    }
154
155
    public function loadVersions(ContentInfo $contentInfo, ?int $status = null)
156
    {
157
        return $this->service->loadVersions($contentInfo, $status);
158
    }
159
160
    public function copyContent(ContentInfo $contentInfo, LocationCreateStruct $destinationLocationCreateStruct, VersionInfo $versionInfo = null)
161
    {
162
        return $this->service->copyContent($contentInfo, $destinationLocationCreateStruct, $versionInfo);
163
    }
164
165
    public function loadRelations(VersionInfo $versionInfo)
166
    {
167
        return $this->service->loadRelations($versionInfo);
168
    }
169
170
    /**
171
     * {@inheritdoc}
172
     */
173
    public function countReverseRelations(ContentInfo $contentInfo): int
174
    {
175
        return $this->service->countReverseRelations($contentInfo);
176
    }
177
178
    public function loadReverseRelations(ContentInfo $contentInfo)
179
    {
180
        return $this->service->loadReverseRelations($contentInfo);
181
    }
182
183
    public function addRelation(VersionInfo $sourceVersion, ContentInfo $destinationContent)
184
    {
185
        return $this->service->addRelation($sourceVersion, $destinationContent);
186
    }
187
188
    public function deleteRelation(VersionInfo $sourceVersion, ContentInfo $destinationContent)
189
    {
190
        return $this->service->deleteRelation($sourceVersion, $destinationContent);
191
    }
192
193
    public function removeTranslation(ContentInfo $contentInfo, $languageCode)
194
    {
195
        return $this->service->removeTranslation($contentInfo, $languageCode);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...ce::removeTranslation() has been deprecated with message: since 6.13, use {@see deleteTranslation} instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
196
    }
197
198
    public function deleteTranslation(ContentInfo $contentInfo, $languageCode)
199
    {
200
        return $this->service->deleteTranslation($contentInfo, $languageCode);
201
    }
202
203
    public function deleteTranslationFromDraft(VersionInfo $versionInfo, $languageCode)
204
    {
205
        return $this->service->deleteTranslationFromDraft($versionInfo, $languageCode);
206
    }
207
208
    public function loadContentListByContentInfo(array $contentInfoList, array $languages = [], $useAlwaysAvailable = true)
209
    {
210
        return $this->service->loadContentListByContentInfo($contentInfoList, $languages, $useAlwaysAvailable);
211
    }
212
213
    public function hideContent(ContentInfo $contentInfo): void
214
    {
215
        $this->service->hideContent($contentInfo);
216
    }
217
218
    public function revealContent(ContentInfo $contentInfo): void
219
    {
220
        $this->service->revealContent($contentInfo);
221
    }
222
223
    public function newContentCreateStruct(ContentType $contentType, $mainLanguageCode)
224
    {
225
        return $this->service->newContentCreateStruct($contentType, $mainLanguageCode);
226
    }
227
228
    public function newContentMetadataUpdateStruct()
229
    {
230
        return $this->service->newContentMetadataUpdateStruct();
231
    }
232
233
    public function newContentUpdateStruct()
234
    {
235
        return $this->service->newContentUpdateStruct();
236
    }
237
}
238