Completed
Push — siteaccessaware-layer-only ( 7e91dd...edaec2 )
by André
56:17 queued 37:14
created

ContentService::deleteTranslation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
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\LocationCreateStruct;
16
use eZ\Publish\API\Repository\Values\ContentType\ContentType;
17
use eZ\Publish\API\Repository\Values\User\User;
18
use eZ\Publish\API\Repository\Values\Content\VersionInfo;
19
use eZ\Publish\API\Repository\Values\Content\ContentInfo;
20
use eZ\Publish\Core\Repository\Helper\LanguageResolver;
21
22
/**
23
 * SiteAccess aware implementation of ContentService injecting languages where needed.
24
 */
25
class ContentService implements ContentServiceInterface
26
{
27
    /** @var \eZ\Publish\API\Repository\ContentService */
28
    protected $service;
29
30
    /** @var LanguageResolver */
31
    protected $languageResolver;
32
33
    /**
34
     * Construct service object from aggregated service and LanguageResolver.
35
     *
36
     * @param \eZ\Publish\API\Repository\ContentService $service
37
     * @param LanguageResolver $languageResolver
38
     */
39
    public function __construct(
40
        ContentServiceInterface $service,
41
        LanguageResolver $languageResolver
42
    ) {
43
        $this->service = $service;
44
        $this->languageResolver = $languageResolver;
45
    }
46
47
    public function loadContentInfo($contentId)
48
    {
49
        return $this->service->loadContentInfo($contentId);
50
    }
51
52
    public function loadContentInfoByRemoteId($remoteId)
53
    {
54
        return $this->service->loadContentInfoByRemoteId($remoteId);
55
    }
56
57
    public function loadVersionInfo(ContentInfo $contentInfo, $versionNo = null)
58
    {
59
        return $this->service->loadVersionInfo($contentInfo, $versionNo);
60
    }
61
62
    public function loadVersionInfoById($contentId, $versionNo = null)
63
    {
64
        return $this->service->loadVersionInfoById($contentId, $versionNo);
65
    }
66
67
    public function loadContentByContentInfo(ContentInfo $contentInfo, array $languages = null, $versionNo = null, $useAlwaysAvailable = null)
68
    {
69
        return $this->service->loadContentByContentInfo(
70
            $contentInfo,
71
            $this->languageResolver->getPrioritizedLanguages($languages),
72
            $versionNo,
73
            $this->languageResolver->getUseAlwaysAvailable($useAlwaysAvailable)
74
        );
75
    }
76
77
    public function loadContentByVersionInfo(VersionInfo $versionInfo, array $languages = null, $useAlwaysAvailable = null)
78
    {
79
        return $this->service->loadContentByVersionInfo(
80
            $versionInfo,
81
            $this->languageResolver->getPrioritizedLanguages($languages),
82
            $this->languageResolver->getUseAlwaysAvailable($useAlwaysAvailable)
83
        );
84
    }
85
86 View Code Duplication
    public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = null)
87
    {
88
        return $this->service->loadContent(
89
            $contentId,
90
            $this->languageResolver->getPrioritizedLanguages($languages),
91
            $versionNo,
92
            $this->languageResolver->getUseAlwaysAvailable($useAlwaysAvailable)
93
        );
94
    }
95
96 View Code Duplication
    public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = null)
97
    {
98
        return $this->service->loadContentByRemoteId(
99
            $remoteId,
100
            $this->languageResolver->getPrioritizedLanguages($languages),
101
            $versionNo,
102
            $this->languageResolver->getUseAlwaysAvailable($useAlwaysAvailable)
103
        );
104
    }
105
106
    public function createContent(ContentCreateStruct $contentCreateStruct, array $locationCreateStructs = array())
107
    {
108
        return $this->service->createContent($contentCreateStruct, $locationCreateStructs);
109
    }
110
111
    public function updateContentMetadata(ContentInfo $contentInfo, ContentMetadataUpdateStruct $contentMetadataUpdateStruct)
112
    {
113
        return $this->service->updateContentMetadata($contentInfo, $contentMetadataUpdateStruct);
114
    }
115
116
    public function deleteContent(ContentInfo $contentInfo)
117
    {
118
        return $this->service->deleteContent($contentInfo);
119
    }
120
121
    public function createContentDraft(ContentInfo $contentInfo, VersionInfo $versionInfo = null, User $user = null)
122
    {
123
        return $this->service->createContentDraft($contentInfo, $versionInfo, $user);
124
    }
125
126
    public function loadContentDrafts(User $user = null)
127
    {
128
        return $this->service->loadContentDrafts($user);
129
    }
130
131
    public function updateContent(VersionInfo $versionInfo, ContentUpdateStruct $contentUpdateStruct)
132
    {
133
        return $this->service->updateContent($versionInfo, $contentUpdateStruct);
134
    }
135
136
    public function publishVersion(VersionInfo $versionInfo)
137
    {
138
        return $this->service->publishVersion($versionInfo);
139
    }
140
141
    public function deleteVersion(VersionInfo $versionInfo)
142
    {
143
        return $this->service->deleteVersion($versionInfo);
144
    }
145
146
    public function loadVersions(ContentInfo $contentInfo)
147
    {
148
        return $this->service->loadVersions($contentInfo);
149
    }
150
151
    public function copyContent(ContentInfo $contentInfo, LocationCreateStruct $destinationLocationCreateStruct, VersionInfo $versionInfo = null)
152
    {
153
        return $this->service->copyContent($contentInfo, $destinationLocationCreateStruct, $versionInfo);
154
    }
155
156
    public function loadRelations(VersionInfo $versionInfo)
157
    {
158
        return $this->service->loadRelations($versionInfo);
159
    }
160
161
    public function loadReverseRelations(ContentInfo $contentInfo)
162
    {
163
        return $this->service->loadReverseRelations($contentInfo);
164
    }
165
166
    public function addRelation(VersionInfo $sourceVersion, ContentInfo $destinationContent)
167
    {
168
        return $this->service->addRelation($sourceVersion, $destinationContent);
169
    }
170
171
    public function deleteRelation(VersionInfo $sourceVersion, ContentInfo $destinationContent)
172
    {
173
        return $this->service->deleteRelation($sourceVersion, $destinationContent);
174
    }
175
176
    public function removeTranslation(ContentInfo $contentInfo, $languageCode)
177
    {
178
        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...
179
    }
180
181
    public function deleteTranslation(ContentInfo $contentInfo, $languageCode)
182
    {
183
        return $this->service->deleteTranslation($contentInfo, $languageCode);
184
    }
185
186
    public function deleteTranslationFromDraft(VersionInfo $versionInfo, $languageCode)
187
    {
188
        return $this->service->deleteTranslationFromDraft($versionInfo, $languageCode);
189
    }
190
191
    public function newContentCreateStruct(ContentType $contentType, $mainLanguageCode)
192
    {
193
        return $this->service->newContentCreateStruct($contentType, $mainLanguageCode);
194
    }
195
196
    public function newContentMetadataUpdateStruct()
197
    {
198
        return $this->service->newContentMetadataUpdateStruct();
199
    }
200
201
    public function newContentUpdateStruct()
202
    {
203
        return $this->service->newContentUpdateStruct();
204
    }
205
}
206