Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
39 | class ContentService implements ContentServiceInterface |
||
40 | { |
||
41 | /** |
||
42 | * Aggregated service. |
||
43 | * |
||
44 | * @var \eZ\Publish\API\Repository\ContentService |
||
45 | */ |
||
46 | protected $service; |
||
47 | |||
48 | /** |
||
49 | * SignalDispatcher. |
||
50 | * |
||
51 | * @var \eZ\Publish\Core\SignalSlot\SignalDispatcher |
||
52 | */ |
||
53 | protected $signalDispatcher; |
||
54 | |||
55 | /** |
||
56 | * Constructor. |
||
57 | * |
||
58 | * Construct service object from aggregated service and signal |
||
59 | * dispatcher |
||
60 | * |
||
61 | * @param \eZ\Publish\API\Repository\ContentService $service |
||
62 | * @param \eZ\Publish\Core\SignalSlot\SignalDispatcher $signalDispatcher |
||
63 | */ |
||
64 | public function __construct(ContentServiceInterface $service, SignalDispatcher $signalDispatcher) |
||
65 | { |
||
66 | $this->service = $service; |
||
67 | $this->signalDispatcher = $signalDispatcher; |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * Loads a content info object. |
||
72 | * |
||
73 | * To load fields use loadContent |
||
74 | * |
||
75 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read the content |
||
76 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the content with the given id does not exist |
||
77 | * |
||
78 | * @param int $contentId |
||
79 | * |
||
80 | * @return \eZ\Publish\API\Repository\Values\Content\ContentInfo |
||
81 | */ |
||
82 | public function loadContentInfo($contentId) |
||
83 | { |
||
84 | return $this->service->loadContentInfo($contentId); |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * Loads a content info object for the given remoteId. |
||
89 | * |
||
90 | * To load fields use loadContent |
||
91 | * |
||
92 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read the content |
||
93 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the content with the given remote id does not exist |
||
94 | * |
||
95 | * @param string $remoteId |
||
96 | * |
||
97 | * @return \eZ\Publish\API\Repository\Values\Content\ContentInfo |
||
98 | */ |
||
99 | public function loadContentInfoByRemoteId($remoteId) |
||
100 | { |
||
101 | return $this->service->loadContentInfoByRemoteId($remoteId); |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * Loads a version info of the given content object. |
||
106 | * |
||
107 | * If no version number is given, the method returns the current version |
||
108 | * |
||
109 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the version with the given number does not exist |
||
110 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version |
||
111 | * |
||
112 | * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
||
113 | * @param int $versionNo the version number. If not given the current version is returned. |
||
114 | * |
||
115 | * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo |
||
116 | */ |
||
117 | public function loadVersionInfo(ContentInfo $contentInfo, $versionNo = null) |
||
118 | { |
||
119 | return $this->service->loadVersionInfo($contentInfo, $versionNo); |
||
120 | } |
||
121 | |||
122 | /** |
||
123 | * Loads a version info of the given content object id. |
||
124 | * |
||
125 | * If no version number is given, the method returns the current version |
||
126 | * |
||
127 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the version with the given number does not exist |
||
128 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version |
||
129 | * |
||
130 | * @param mixed $contentId |
||
131 | * @param int $versionNo the version number. If not given the current version is returned. |
||
132 | * |
||
133 | * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo |
||
134 | */ |
||
135 | public function loadVersionInfoById($contentId, $versionNo = null) |
||
136 | { |
||
137 | return $this->service->loadVersionInfoById($contentId, $versionNo); |
||
138 | } |
||
139 | |||
140 | /** |
||
141 | * Loads content in a version for the given content info object. |
||
142 | * |
||
143 | * If no version number is given, the method returns the current version |
||
144 | * |
||
145 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if version with the given number does not exist |
||
146 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version |
||
147 | * |
||
148 | * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
||
149 | * @param array $languages A language filter for fields. If not given all languages are returned |
||
150 | * @param int $versionNo the version number. If not given the current version is returned |
||
151 | * @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true |
||
152 | * |
||
153 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
||
154 | */ |
||
155 | public function loadContentByContentInfo(ContentInfo $contentInfo, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) |
||
156 | { |
||
157 | return $this->service->loadContentByContentInfo($contentInfo, $languages, $versionNo, $useAlwaysAvailable); |
||
158 | } |
||
159 | |||
160 | /** |
||
161 | * Loads content in the version given by version info. |
||
162 | * |
||
163 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version |
||
164 | * |
||
165 | * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
||
166 | * @param array $languages A language filter for fields. If not given all languages are returned |
||
167 | * @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true |
||
168 | * |
||
169 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
||
170 | */ |
||
171 | public function loadContentByVersionInfo(VersionInfo $versionInfo, array $languages = null, $useAlwaysAvailable = true) |
||
172 | { |
||
173 | return $this->service->loadContentByVersionInfo($versionInfo, $languages, $useAlwaysAvailable); |
||
174 | } |
||
175 | |||
176 | /** |
||
177 | * Loads content in a version of the given content object. |
||
178 | * |
||
179 | * If no version number is given, the method returns the current version |
||
180 | * |
||
181 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if the content or version with the given id and languages does not exist |
||
182 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version |
||
183 | * |
||
184 | * @param int $contentId |
||
185 | * @param array $languages A language filter for fields. If not given all languages are returned |
||
186 | * @param int $versionNo the version number. If not given the current version is returned |
||
187 | * @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true |
||
188 | * |
||
189 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
||
190 | */ |
||
191 | public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) |
||
192 | { |
||
193 | return $this->service->loadContent($contentId, $languages, $versionNo, $useAlwaysAvailable); |
||
194 | } |
||
195 | |||
196 | /** |
||
197 | * Loads content in a version for the content object reference by the given remote id. |
||
198 | * |
||
199 | * If no version is given, the method returns the current version |
||
200 | * |
||
201 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the content or version with the given remote id does not exist |
||
202 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version |
||
203 | * |
||
204 | * @param string $remoteId |
||
205 | * @param array $languages A language filter for fields. If not given all languages are returned |
||
206 | * @param int $versionNo the version number. If not given the current version is returned |
||
207 | * @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true |
||
208 | * |
||
209 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
||
210 | */ |
||
211 | public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) |
||
212 | { |
||
213 | return $this->service->loadContentByRemoteId($remoteId, $languages, $versionNo, $useAlwaysAvailable); |
||
214 | } |
||
215 | |||
216 | /** |
||
217 | * Creates a new content draft assigned to the authenticated user. |
||
218 | * |
||
219 | * If a different userId is given in $contentCreateStruct it is assigned to the given user |
||
220 | * but this required special rights for the authenticated user |
||
221 | * (this is useful for content staging where the transfer process does not |
||
222 | * have to authenticate with the user which created the content object in the source server). |
||
223 | * The user has to publish the draft if it should be visible. |
||
224 | * In 4.x at least one location has to be provided in the location creation array. |
||
225 | * |
||
226 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create the content in the given location |
||
227 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if there is a provided remoteId which exists in the system |
||
228 | * or there is no location provided (4.x) or multiple locations |
||
229 | * are under the same parent or if the a field value is not accepted by the field type |
||
230 | * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $contentCreateStruct is not valid |
||
231 | * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is missing or is set to an empty value |
||
232 | * |
||
233 | * @param \eZ\Publish\API\Repository\Values\Content\ContentCreateStruct $contentCreateStruct |
||
234 | * @param \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct[] $locationCreateStructs For each location parent under which a location should be created for the content |
||
235 | * |
||
236 | * @return \eZ\Publish\API\Repository\Values\Content\Content - the newly created content draft |
||
237 | */ |
||
238 | public function createContent(ContentCreateStruct $contentCreateStruct, array $locationCreateStructs = array()) |
||
239 | { |
||
240 | $returnValue = $this->service->createContent($contentCreateStruct, $locationCreateStructs); |
||
241 | $this->signalDispatcher->emit( |
||
242 | new CreateContentSignal( |
||
243 | array( |
||
244 | 'contentId' => $returnValue->getVersionInfo()->getContentInfo()->id, |
||
245 | 'versionNo' => $returnValue->getVersionInfo()->versionNo, |
||
246 | ) |
||
247 | ) |
||
248 | ); |
||
249 | |||
250 | return $returnValue; |
||
251 | } |
||
252 | |||
253 | /** |
||
254 | * Updates the metadata. |
||
255 | * |
||
256 | * (see {@link ContentMetadataUpdateStruct}) of a content object - to update fields use updateContent |
||
257 | * |
||
258 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update the content meta data |
||
259 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the remoteId in $contentMetadataUpdateStruct is set but already exists |
||
260 | * |
||
261 | * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
||
262 | * @param \eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct $contentMetadataUpdateStruct |
||
263 | * |
||
264 | * @return \eZ\Publish\API\Repository\Values\Content\Content the content with the updated attributes |
||
265 | */ |
||
266 | public function updateContentMetadata(ContentInfo $contentInfo, ContentMetadataUpdateStruct $contentMetadataUpdateStruct) |
||
267 | { |
||
268 | $returnValue = $this->service->updateContentMetadata($contentInfo, $contentMetadataUpdateStruct); |
||
269 | $this->signalDispatcher->emit( |
||
270 | new UpdateContentMetadataSignal( |
||
271 | array( |
||
272 | 'contentId' => $contentInfo->id, |
||
273 | ) |
||
274 | ) |
||
275 | ); |
||
276 | |||
277 | return $returnValue; |
||
278 | } |
||
279 | |||
280 | /** |
||
281 | * Deletes a content object including all its versions and locations including their subtrees. |
||
282 | * |
||
283 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to delete the content (in one of the locations of the given content object) |
||
284 | * |
||
285 | * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
||
286 | * |
||
287 | * @return mixed[] Affected Location Id's |
||
288 | */ |
||
289 | public function deleteContent(ContentInfo $contentInfo) |
||
290 | { |
||
291 | $returnValue = $this->service->deleteContent($contentInfo); |
||
292 | $this->signalDispatcher->emit( |
||
293 | new DeleteContentSignal( |
||
294 | array( |
||
295 | 'contentId' => $contentInfo->id, |
||
296 | 'affectedLocationIds' => $returnValue, |
||
297 | ) |
||
298 | ) |
||
299 | ); |
||
300 | |||
301 | return $returnValue; |
||
302 | } |
||
303 | |||
304 | /** |
||
305 | * Creates a draft from a published or archived version. |
||
306 | * |
||
307 | * If no version is given, the current published version is used. |
||
308 | * 4.x: The draft is created with the initialLanguage code of the source version or if not present with the main language. |
||
309 | * It can be changed on updating the version. |
||
310 | * |
||
311 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create the draft |
||
312 | * |
||
313 | * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
||
314 | * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
||
315 | * @param \eZ\Publish\API\Repository\Values\User\User $user if set given user is used to create the draft - otherwise the current user is used |
||
316 | * |
||
317 | * @return \eZ\Publish\API\Repository\Values\Content\Content - the newly created content draft |
||
318 | */ |
||
319 | public function createContentDraft(ContentInfo $contentInfo, VersionInfo $versionInfo = null, User $user = null) |
||
334 | |||
335 | /** |
||
336 | * Loads drafts for a user. |
||
337 | * |
||
338 | * If no user is given the drafts for the authenticated user a returned |
||
339 | * |
||
340 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load the draft list |
||
341 | * |
||
342 | * @param \eZ\Publish\API\Repository\Values\User\User $user |
||
343 | * |
||
344 | * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo[] the drafts ({@link VersionInfo}) owned by the given user |
||
345 | */ |
||
346 | public function loadContentDrafts(User $user = null) |
||
350 | |||
351 | /** |
||
352 | * Translate a version. |
||
353 | * |
||
354 | * updates the destination version given in $translationInfo with the provided translated fields in $translationValues |
||
355 | * |
||
356 | * @example Examples/translation_5x.php |
||
357 | * |
||
358 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update this version |
||
359 | * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the given destination version is not a draft |
||
360 | * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is set to an empty value |
||
361 | * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $translationValues is not valid |
||
362 | * |
||
363 | * @param \eZ\Publish\API\Repository\Values\Content\TranslationInfo $translationInfo |
||
364 | * @param \eZ\Publish\API\Repository\Values\Content\TranslationValues $translationValues |
||
365 | * @param \eZ\Publish\API\Repository\Values\User\User $user If set, this user is taken as modifier of the version |
||
366 | * |
||
367 | * @return \eZ\Publish\API\Repository\Values\Content\Content the content draft with the translated fields |
||
368 | * |
||
369 | * @since 5.0 |
||
370 | */ |
||
371 | public function translateVersion(TranslationInfo $translationInfo, TranslationValues $translationValues, User $user = null) |
||
386 | |||
387 | /** |
||
388 | * Updates the fields of a draft. |
||
389 | * |
||
390 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update this version |
||
391 | * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft |
||
392 | * @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $contentUpdateStruct is not valid |
||
393 | * @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is set to an empty value |
||
394 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if a field value is not accepted by the field type |
||
395 | * |
||
396 | * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
||
397 | * @param \eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct $contentUpdateStruct |
||
398 | * |
||
399 | * @return \eZ\Publish\API\Repository\Values\Content\Content the content draft with the updated fields |
||
400 | */ |
||
401 | View Code Duplication | public function updateContent(VersionInfo $versionInfo, ContentUpdateStruct $contentUpdateStruct) |
|
415 | |||
416 | /** |
||
417 | * Publishes a content version. |
||
418 | * |
||
419 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to publish this version |
||
420 | * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft |
||
421 | * |
||
422 | * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
||
423 | * |
||
424 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
||
425 | */ |
||
426 | View Code Duplication | public function publishVersion(VersionInfo $versionInfo) |
|
440 | |||
441 | /** |
||
442 | * Removes the given version. |
||
443 | * |
||
444 | * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is in |
||
445 | * published state or is the last version of the Content |
||
446 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to remove this version |
||
447 | * |
||
448 | * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
||
449 | */ |
||
450 | View Code Duplication | public function deleteVersion(VersionInfo $versionInfo) |
|
464 | |||
465 | /** |
||
466 | * Loads all versions for the given content. |
||
467 | * |
||
468 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to list versions |
||
469 | * |
||
470 | * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
||
471 | * |
||
472 | * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo[] Sorted by creation date |
||
473 | */ |
||
474 | public function loadVersions(ContentInfo $contentInfo) |
||
478 | |||
479 | /** |
||
480 | * Copies the content to a new location. If no version is given, |
||
481 | * all versions are copied, otherwise only the given version. |
||
482 | * |
||
483 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to copy the content to the given location |
||
484 | * |
||
485 | * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
||
486 | * @param \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct $destinationLocationCreateStruct the target location where the content is copied to |
||
487 | * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
||
488 | * |
||
489 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
||
490 | */ |
||
491 | public function copyContent(ContentInfo $contentInfo, LocationCreateStruct $destinationLocationCreateStruct, VersionInfo $versionInfo = null) |
||
508 | |||
509 | /** |
||
510 | * Loads all outgoing relations for the given version. |
||
511 | * |
||
512 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read this version |
||
513 | * |
||
514 | * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
||
515 | * |
||
516 | * @return \eZ\Publish\API\Repository\Values\Content\Relation[] |
||
517 | */ |
||
518 | public function loadRelations(VersionInfo $versionInfo) |
||
522 | |||
523 | /** |
||
524 | * Loads all incoming relations for a content object. |
||
525 | * |
||
526 | * The relations come only from published versions of the source content objects |
||
527 | * |
||
528 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read this version |
||
529 | * |
||
530 | * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
||
531 | * |
||
532 | * @return \eZ\Publish\API\Repository\Values\Content\Relation[] |
||
533 | */ |
||
534 | public function loadReverseRelations(ContentInfo $contentInfo) |
||
538 | |||
539 | /** |
||
540 | * Adds a relation of type common. |
||
541 | * |
||
542 | * The source of the relation is the content and version |
||
543 | * referenced by $versionInfo. |
||
544 | * |
||
545 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to edit this version |
||
546 | * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft |
||
547 | * |
||
548 | * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $sourceVersion |
||
549 | * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContent the destination of the relation |
||
550 | * |
||
551 | * @return \eZ\Publish\API\Repository\Values\Content\Relation the newly created relation |
||
552 | */ |
||
553 | View Code Duplication | public function addRelation(VersionInfo $sourceVersion, ContentInfo $destinationContent) |
|
568 | |||
569 | /** |
||
570 | * Removes a relation of type COMMON from a draft. |
||
571 | * |
||
572 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed edit this version |
||
573 | * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft |
||
574 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if there is no relation of type COMMON for the given destination |
||
575 | * |
||
576 | * @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $sourceVersion |
||
577 | * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContent |
||
578 | */ |
||
579 | View Code Duplication | public function deleteRelation(VersionInfo $sourceVersion, ContentInfo $destinationContent) |
|
594 | |||
595 | /** |
||
596 | * Adds translation information to the content object. |
||
597 | * |
||
598 | * @example Examples/translation_5x.php |
||
599 | * |
||
600 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed add a translation info |
||
601 | * |
||
602 | * @param \eZ\Publish\API\Repository\Values\Content\TranslationInfo $translationInfo |
||
603 | * |
||
604 | * @since 5.0 |
||
605 | */ |
||
606 | public function addTranslationInfo(TranslationInfo $translationInfo) |
||
615 | |||
616 | /** |
||
617 | * lists the translations done on this content object. |
||
618 | * |
||
619 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed read translation infos |
||
620 | * |
||
621 | * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
||
622 | * @param array $filter |
||
623 | * |
||
624 | * @todo TBD - filter by source version, destination version and languages |
||
625 | * |
||
626 | * @return \eZ\Publish\API\Repository\Values\Content\TranslationInfo[] |
||
627 | * |
||
628 | * @since 5.0 |
||
629 | */ |
||
630 | public function loadTranslationInfos(ContentInfo $contentInfo, array $filter = array()) |
||
634 | |||
635 | /** |
||
636 | * Remove Content Object translation from all Versions (including archived ones) of a Content Object. |
||
637 | * |
||
638 | * NOTE: this operation is risky and permanent, so user interface (ideally CLI) should provide |
||
639 | * a warning before performing it. |
||
640 | * |
||
641 | * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the specified translation |
||
642 | * is the only one a Version has or it is the main translation of a Content Object. |
||
643 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed |
||
644 | * to delete the content (in one of the locations of the given Content Object). |
||
645 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if languageCode argument |
||
646 | * is invalid for the given content. |
||
647 | * |
||
648 | * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
||
649 | * @param string $languageCode |
||
650 | * |
||
651 | * @since 6.11 |
||
652 | */ |
||
653 | public function removeTranslation(ContentInfo $contentInfo, $languageCode) |
||
660 | |||
661 | /** |
||
662 | * Instantiates a new content create struct object. |
||
663 | * |
||
664 | * alwaysAvailable is set to the ContentType's defaultAlwaysAvailable |
||
665 | * |
||
666 | * @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType |
||
667 | * @param string $mainLanguageCode |
||
668 | * |
||
669 | * @return \eZ\Publish\API\Repository\Values\Content\ContentCreateStruct |
||
670 | */ |
||
671 | public function newContentCreateStruct(ContentType $contentType, $mainLanguageCode) |
||
675 | |||
676 | /** |
||
677 | * Instantiates a new content meta data update struct. |
||
678 | * |
||
679 | * @return \eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct |
||
680 | */ |
||
681 | public function newContentMetadataUpdateStruct() |
||
685 | |||
686 | /** |
||
687 | * Instantiates a new content update struct. |
||
688 | * |
||
689 | * @return \eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct |
||
690 | */ |
||
691 | public function newContentUpdateStruct() |
||
695 | |||
696 | /** |
||
697 | * Instantiates a new TranslationInfo object. |
||
698 | * |
||
699 | * @return \eZ\Publish\API\Repository\Values\Content\TranslationInfo |
||
700 | */ |
||
701 | public function newTranslationInfo() |
||
705 | |||
706 | /** |
||
707 | * Instantiates a Translation object. |
||
708 | * |
||
709 | * @return \eZ\Publish\API\Repository\Values\Content\TranslationValues |
||
710 | */ |
||
711 | public function newTranslationValues() |
||
715 | } |
||
716 |
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.