|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* File containing the 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\REST\Client; |
|
10
|
|
|
|
|
11
|
|
|
use eZ\Publish\API\Repository\ContentService as APIContentService; |
|
12
|
|
|
use eZ\Publish\API\Repository\Values\Content\ContentInfo; |
|
13
|
|
|
use eZ\Publish\API\Repository\Values\Content\ContentCreateStruct; |
|
14
|
|
|
use eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct; |
|
15
|
|
|
use eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct; |
|
16
|
|
|
use eZ\Publish\API\Repository\Values\Content\LocationCreateStruct; |
|
17
|
|
|
use eZ\Publish\API\Repository\Values\Content\TranslationInfo; |
|
18
|
|
|
use eZ\Publish\API\Repository\Values\Content\TranslationValues; |
|
19
|
|
|
use eZ\Publish\API\Repository\Values\Content\VersionInfo; |
|
20
|
|
|
use eZ\Publish\API\Repository\Values\ContentType\ContentType; |
|
21
|
|
|
use eZ\Publish\API\Repository\Values\Content\Query; |
|
22
|
|
|
use eZ\Publish\API\Repository\Values\User\User; |
|
23
|
|
|
use eZ\Publish\Core\REST\Common\RequestParser; |
|
24
|
|
|
use eZ\Publish\Core\REST\Common\Input\Dispatcher; |
|
25
|
|
|
use eZ\Publish\Core\REST\Common\Output\Visitor; |
|
26
|
|
|
use eZ\Publish\Core\REST\Common\Message; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @example Examples/contenttype.php |
|
30
|
|
|
*/ |
|
31
|
|
|
class ContentService implements APIContentService, Sessionable |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* @var \eZ\Publish\Core\REST\Client\HttpClient |
|
35
|
|
|
*/ |
|
36
|
|
|
private $client; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var \eZ\Publish\Core\REST\Common\Input\Dispatcher |
|
40
|
|
|
*/ |
|
41
|
|
|
private $inputDispatcher; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var \eZ\Publish\Core\REST\Common\Output\Visitor |
|
45
|
|
|
*/ |
|
46
|
|
|
private $outputVisitor; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var \eZ\Publish\Core\REST\Common\RequestParser |
|
50
|
|
|
*/ |
|
51
|
|
|
private $requestParser; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var \eZ\Publish\Core\REST\Client\ContentTypeService |
|
55
|
|
|
*/ |
|
56
|
|
|
private $contentTypeService; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @param \eZ\Publish\Core\REST\Client\HttpClient $client |
|
60
|
|
|
* @param \eZ\Publish\Core\REST\Common\Input\Dispatcher $inputDispatcher |
|
61
|
|
|
* @param \eZ\Publish\Core\REST\Common\Output\Visitor $outputVisitor |
|
62
|
|
|
* @param \eZ\Publish\Core\REST\Common\RequestParser $requestParser |
|
63
|
|
|
* @param \eZ\Publish\Core\REST\Client\ContentTypeService $contentTypeService |
|
64
|
|
|
*/ |
|
65
|
|
View Code Duplication |
public function __construct(HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, RequestParser $requestParser, ContentTypeService $contentTypeService) |
|
66
|
|
|
{ |
|
67
|
|
|
$this->client = $client; |
|
68
|
|
|
$this->inputDispatcher = $inputDispatcher; |
|
69
|
|
|
$this->outputVisitor = $outputVisitor; |
|
70
|
|
|
$this->requestParser = $requestParser; |
|
71
|
|
|
$this->contentTypeService = $contentTypeService; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Set session ID. |
|
76
|
|
|
* |
|
77
|
|
|
* Only for testing |
|
78
|
|
|
* |
|
79
|
|
|
* @param mixed $id |
|
80
|
|
|
* |
|
81
|
|
|
* @private |
|
82
|
|
|
*/ |
|
83
|
|
|
public function setSession($id) |
|
84
|
|
|
{ |
|
85
|
|
|
if ($this->outputVisitor instanceof Sessionable) { |
|
86
|
|
|
$this->outputVisitor->setSession($id); |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* Loads a content info object. |
|
92
|
|
|
* |
|
93
|
|
|
* To load fields use loadContent |
|
94
|
|
|
* |
|
95
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read the content |
|
96
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the content with the given id does not exist |
|
97
|
|
|
* |
|
98
|
|
|
* @param int $contentId |
|
99
|
|
|
* |
|
100
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\ContentInfo |
|
101
|
|
|
*/ |
|
102
|
|
|
public function loadContentInfo($contentId) |
|
103
|
|
|
{ |
|
104
|
|
|
$response = $this->client->request( |
|
105
|
|
|
'GET', |
|
106
|
|
|
$contentId, |
|
107
|
|
|
new Message( |
|
108
|
|
|
array('Accept' => $this->outputVisitor->getMediaType('ContentInfo')) |
|
109
|
|
|
) |
|
110
|
|
|
); |
|
111
|
|
|
|
|
112
|
|
|
$restContentInfo = $this->inputDispatcher->parse($response); |
|
113
|
|
|
|
|
114
|
|
|
return $this->completeContentInfo($restContentInfo); |
|
|
|
|
|
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* Loads a content info object for the given remoteId. |
|
119
|
|
|
* |
|
120
|
|
|
* To load fields use loadContent |
|
121
|
|
|
* |
|
122
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create the content in the given location |
|
123
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the content with the given remote id does not exist |
|
124
|
|
|
* |
|
125
|
|
|
* @param string $remoteId |
|
126
|
|
|
* |
|
127
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\ContentInfo |
|
128
|
|
|
*/ |
|
129
|
|
View Code Duplication |
public function loadContentInfoByRemoteId($remoteId) |
|
130
|
|
|
{ |
|
131
|
|
|
$response = $this->client->request( |
|
132
|
|
|
'GET', |
|
133
|
|
|
$this->requestParser->generate('objectByRemote', array('object' => $remoteId)), |
|
134
|
|
|
new Message( |
|
135
|
|
|
array('Accept' => $this->outputVisitor->getMediaType('ContentInfo')) |
|
136
|
|
|
) |
|
137
|
|
|
); |
|
138
|
|
|
|
|
139
|
|
|
if ($response->statusCode == 307) { |
|
140
|
|
|
$response = $this->client->request( |
|
141
|
|
|
'GET', |
|
142
|
|
|
$response->headers['Location'], |
|
143
|
|
|
new Message( |
|
144
|
|
|
array('Accept' => $this->outputVisitor->getMediaType('ContentInfo')) |
|
145
|
|
|
) |
|
146
|
|
|
); |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
$restContentInfo = $this->inputDispatcher->parse($response); |
|
150
|
|
|
|
|
151
|
|
|
return $this->completeContentInfo($restContentInfo); |
|
|
|
|
|
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* Returns a complete ContentInfo based on $restContentInfo. |
|
156
|
|
|
* |
|
157
|
|
|
* @param \eZ\Publish\Core\REST\Client\Values\RestContentInfo $restContentInfo |
|
158
|
|
|
* |
|
159
|
|
|
* @return \eZ\Publish\Core\REST\Client\Values\Content\ContentInfo |
|
160
|
|
|
*/ |
|
161
|
|
|
protected function completeContentInfo(Values\RestContentInfo $restContentInfo) |
|
162
|
|
|
{ |
|
163
|
|
|
$versionUrlValues = $this->requestParser->parse( |
|
164
|
|
|
'objectVersion', |
|
165
|
|
|
$this->fetchCurrentVersionUrl($restContentInfo->currentVersionReference) |
|
|
|
|
|
|
166
|
|
|
); |
|
167
|
|
|
|
|
168
|
|
|
return new Values\Content\ContentInfo( |
|
169
|
|
|
$this->contentTypeService, |
|
170
|
|
|
array( |
|
171
|
|
|
'id' => $restContentInfo->id, |
|
|
|
|
|
|
172
|
|
|
'name' => $restContentInfo->name, |
|
|
|
|
|
|
173
|
|
|
'contentTypeId' => $restContentInfo->contentTypeId, |
|
|
|
|
|
|
174
|
|
|
'ownerId' => $restContentInfo->ownerId, |
|
|
|
|
|
|
175
|
|
|
'modificationDate' => $restContentInfo->modificationDate, |
|
|
|
|
|
|
176
|
|
|
'publishedDate' => $restContentInfo->publishedDate, |
|
|
|
|
|
|
177
|
|
|
'published' => $restContentInfo->published, |
|
|
|
|
|
|
178
|
|
|
'alwaysAvailable' => $restContentInfo->alwaysAvailable, |
|
|
|
|
|
|
179
|
|
|
'remoteId' => $restContentInfo->remoteId, |
|
|
|
|
|
|
180
|
|
|
'mainLanguageCode' => $restContentInfo->mainLanguageCode, |
|
|
|
|
|
|
181
|
|
|
'mainLocationId' => $restContentInfo->mainLocationId, |
|
|
|
|
|
|
182
|
|
|
'sectionId' => $restContentInfo->sectionId, |
|
|
|
|
|
|
183
|
|
|
|
|
184
|
|
|
'currentVersionNo' => $versionUrlValues['version'], |
|
185
|
|
|
) |
|
186
|
|
|
); |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
/** |
|
190
|
|
|
* Returns the URL of the current version referenced by |
|
191
|
|
|
* $currentVersionReference. |
|
192
|
|
|
* |
|
193
|
|
|
* @param string $currentVersionReference |
|
194
|
|
|
* |
|
195
|
|
|
* @return string |
|
196
|
|
|
*/ |
|
197
|
|
|
protected function fetchCurrentVersionUrl($currentVersionReference) |
|
198
|
|
|
{ |
|
199
|
|
|
$versionResponse = $this->client->request( |
|
200
|
|
|
'GET', |
|
201
|
|
|
$currentVersionReference |
|
202
|
|
|
); |
|
203
|
|
|
|
|
204
|
|
|
if ($this->isErrorResponse($versionResponse)) { |
|
205
|
|
|
return $this->inputDispatcher->parse($versionResponse); |
|
|
|
|
|
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
return $versionResponse->headers['Location']; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
/** |
|
212
|
|
|
* Checks if the given response is an error. |
|
213
|
|
|
* |
|
214
|
|
|
* @param Message $response |
|
215
|
|
|
* |
|
216
|
|
|
* @return bool |
|
217
|
|
|
*/ |
|
218
|
|
|
protected function isErrorResponse(Message $response) |
|
219
|
|
|
{ |
|
220
|
|
|
return strpos($response->headers['Content-Type'], 'application/vnd.ez.api.ErrorMessage') === 0; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* Loads a version info of the given content object. |
|
225
|
|
|
* |
|
226
|
|
|
* If no version number is given, the method returns the current version |
|
227
|
|
|
* |
|
228
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the version with the given number does not exist |
|
229
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version |
|
230
|
|
|
* |
|
231
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
|
232
|
|
|
* @param int $versionNo the version number. If not given the current version is returned. |
|
233
|
|
|
* |
|
234
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\VersionInfo |
|
235
|
|
|
*/ |
|
236
|
|
|
public function loadVersionInfo(ContentInfo $contentInfo, $versionNo = null) |
|
237
|
|
|
{ |
|
238
|
|
|
throw new \Exception('@todo: Implement.'); |
|
239
|
|
|
} |
|
240
|
|
|
|
|
241
|
|
|
/** |
|
242
|
|
|
* Loads a version info of the given content object id. |
|
243
|
|
|
* |
|
244
|
|
|
* If no version number is given, the method returns the current version |
|
245
|
|
|
* |
|
246
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the version with the given number does not exist |
|
247
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version |
|
248
|
|
|
* |
|
249
|
|
|
* @param mixed $contentId |
|
250
|
|
|
* @param int $versionNo the version number. If not given the current version is returned. |
|
251
|
|
|
* |
|
252
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\VersionInfo |
|
253
|
|
|
*/ |
|
254
|
|
|
public function loadVersionInfoById($contentId, $versionNo = null) |
|
255
|
|
|
{ |
|
256
|
|
|
throw new \Exception('@todo: Implement.'); |
|
257
|
|
|
} |
|
258
|
|
|
|
|
259
|
|
|
/** |
|
260
|
|
|
* Loads content in a version for the given content info object. |
|
261
|
|
|
* |
|
262
|
|
|
* If no version number is given, the method returns the current version |
|
263
|
|
|
* |
|
264
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if version with the given number does not exist |
|
265
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version |
|
266
|
|
|
* |
|
267
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
|
268
|
|
|
* @param array $languages A language filter for fields. If not given all languages are returned |
|
269
|
|
|
* @param int $versionNo the version number. If not given the current version is returned |
|
270
|
|
|
* @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true |
|
271
|
|
|
* |
|
272
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Content |
|
273
|
|
|
*/ |
|
274
|
|
|
public function loadContentByContentInfo(ContentInfo $contentInfo, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) |
|
275
|
|
|
{ |
|
276
|
|
|
return $this->loadContent( |
|
277
|
|
|
$contentInfo->id, |
|
278
|
|
|
$languages, |
|
279
|
|
|
$versionNo |
|
280
|
|
|
); |
|
281
|
|
|
} |
|
282
|
|
|
|
|
283
|
|
|
/** |
|
284
|
|
|
* Loads content in the version given by version info. |
|
285
|
|
|
* |
|
286
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version |
|
287
|
|
|
* |
|
288
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
|
289
|
|
|
* @param array $languages A language filter for fields. If not given all languages are returned |
|
290
|
|
|
* @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true |
|
291
|
|
|
* |
|
292
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Content |
|
293
|
|
|
*/ |
|
294
|
|
|
public function loadContentByVersionInfo(VersionInfo $versionInfo, array $languages = null, $useAlwaysAvailable = true) |
|
295
|
|
|
{ |
|
296
|
|
|
$contentInfo = $versionInfo->getContentInfo(); |
|
297
|
|
|
|
|
298
|
|
|
return $this->loadContent($contentInfo->id, $languages, $versionInfo->versionNo); |
|
299
|
|
|
} |
|
300
|
|
|
|
|
301
|
|
|
/** |
|
302
|
|
|
* Loads content in a version of the given content object. |
|
303
|
|
|
* |
|
304
|
|
|
* If no version number is given, the method returns the current version |
|
305
|
|
|
* |
|
306
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the content or version with the given id does not exist |
|
307
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version |
|
308
|
|
|
* |
|
309
|
|
|
* @param int $contentId |
|
310
|
|
|
* @param array $languages A language filter for fields. If not given all languages are returned |
|
311
|
|
|
* @param int $versionNo the version number. If not given the current version is returned |
|
312
|
|
|
* @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true |
|
313
|
|
|
* |
|
314
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Content |
|
315
|
|
|
* |
|
316
|
|
|
* @todo Handle $versionNo = null |
|
317
|
|
|
* @todo Handle language filters |
|
318
|
|
|
*/ |
|
319
|
|
|
public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) |
|
320
|
|
|
{ |
|
321
|
|
|
// $contentId should already be a URL! |
|
322
|
|
|
$contentIdValues = $this->requestParser->parse('object', $contentId); |
|
323
|
|
|
|
|
324
|
|
|
$url = ''; |
|
|
|
|
|
|
325
|
|
|
if ($versionNo === null) { |
|
326
|
|
|
$url = $this->fetchCurrentVersionUrl( |
|
327
|
|
|
$this->requestParser->generate( |
|
328
|
|
|
'objectCurrentVersion', |
|
329
|
|
|
array( |
|
330
|
|
|
'object' => $contentIdValues['object'], |
|
331
|
|
|
) |
|
332
|
|
|
) |
|
333
|
|
|
); |
|
334
|
|
|
} else { |
|
335
|
|
|
$url = $this->requestParser->generate( |
|
336
|
|
|
'objectVersion', |
|
337
|
|
|
array( |
|
338
|
|
|
'object' => $contentIdValues['object'], |
|
339
|
|
|
'version' => $versionNo, |
|
340
|
|
|
) |
|
341
|
|
|
); |
|
342
|
|
|
} |
|
343
|
|
|
|
|
344
|
|
|
$response = $this->client->request( |
|
345
|
|
|
'GET', |
|
346
|
|
|
$url, |
|
347
|
|
|
new Message( |
|
348
|
|
|
array('Accept' => $this->outputVisitor->getMediaType('Version')) |
|
349
|
|
|
) |
|
350
|
|
|
); |
|
351
|
|
|
|
|
352
|
|
|
return $this->inputDispatcher->parse($response); |
|
353
|
|
|
} |
|
354
|
|
|
|
|
355
|
|
|
/** |
|
356
|
|
|
* Loads content in a version for the content object reference by the given remote id. |
|
357
|
|
|
* |
|
358
|
|
|
* If no version is given, the method returns the current version |
|
359
|
|
|
* |
|
360
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException - if the content or version with the given remote id does not exist |
|
361
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load this version |
|
362
|
|
|
* |
|
363
|
|
|
* @param string $remoteId |
|
364
|
|
|
* @param array $languages A language filter for fields. If not given all languages are returned |
|
365
|
|
|
* @param int $versionNo the version number. If not given the current version is returned |
|
366
|
|
|
* @param bool $useAlwaysAvailable Add Main language to \$languages if true (default) and if alwaysAvailable is true |
|
367
|
|
|
* |
|
368
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Content |
|
369
|
|
|
*/ |
|
370
|
|
|
public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true) |
|
371
|
|
|
{ |
|
372
|
|
|
$contentInfo = $this->loadContentInfoByRemoteId($remoteId); |
|
373
|
|
|
|
|
374
|
|
|
return $this->loadContentByContentInfo($contentInfo, $languages, $versionNo); |
|
375
|
|
|
} |
|
376
|
|
|
|
|
377
|
|
|
/** |
|
378
|
|
|
* Creates a new content draft assigned to the authenticated user. |
|
379
|
|
|
* |
|
380
|
|
|
* If a different userId is given in $contentCreateStruct it is assigned to the given user |
|
381
|
|
|
* but this required special rights for the authenticated user |
|
382
|
|
|
* (this is useful for content staging where the transfer process does not |
|
383
|
|
|
* have to authenticate with the user which created the content object in the source server). |
|
384
|
|
|
* The user has to publish the draft if it should be visible. |
|
385
|
|
|
* In 4.x at least one location has to be provided in the location creation array. |
|
386
|
|
|
* |
|
387
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create the content in the given location |
|
388
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if there is a provided remoteId which exists in the system |
|
389
|
|
|
* or there is no location provided (4.x) or multiple locations |
|
390
|
|
|
* are under the same parent or if the a field value is not accepted by the field type |
|
391
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $contentCreateStruct is not valid |
|
392
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is missing |
|
393
|
|
|
* |
|
394
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentCreateStruct $contentCreateStruct |
|
395
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct[] $locationCreateStructs For each location parent under which a location should be created for the content |
|
396
|
|
|
* |
|
397
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Content - the newly created content draft |
|
398
|
|
|
*/ |
|
399
|
|
|
public function createContent(ContentCreateStruct $contentCreateStruct, array $locationCreateStructs = array()) |
|
400
|
|
|
{ |
|
401
|
|
|
throw new \Exception('@todo: Implement.'); |
|
402
|
|
|
} |
|
403
|
|
|
|
|
404
|
|
|
/** |
|
405
|
|
|
* Updates the metadata. |
|
406
|
|
|
* |
|
407
|
|
|
* (see {@link ContentMetadataUpdateStruct}) of a content object - to update fields use updateContent |
|
408
|
|
|
* |
|
409
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update the content meta data |
|
410
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the remoteId in $contentMetadataUpdateStruct is set but already exists |
|
411
|
|
|
* |
|
412
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
|
413
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct $contentMetadataUpdateStruct |
|
414
|
|
|
* |
|
415
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Content the content with the updated attributes |
|
416
|
|
|
*/ |
|
417
|
|
|
public function updateContentMetadata(ContentInfo $contentInfo, ContentMetadataUpdateStruct $contentMetadataUpdateStruct) |
|
418
|
|
|
{ |
|
419
|
|
|
throw new \Exception('@todo: Implement.'); |
|
420
|
|
|
} |
|
421
|
|
|
|
|
422
|
|
|
/** |
|
423
|
|
|
* Deletes a content object including all its versions and locations including their subtrees. |
|
424
|
|
|
* |
|
425
|
|
|
* @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) |
|
426
|
|
|
* |
|
427
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
|
428
|
|
|
*/ |
|
429
|
|
|
public function deleteContent(ContentInfo $contentInfo) |
|
430
|
|
|
{ |
|
431
|
|
|
throw new \Exception('@todo: Implement.'); |
|
432
|
|
|
} |
|
433
|
|
|
|
|
434
|
|
|
/** |
|
435
|
|
|
* Creates a draft from a published or archived version. |
|
436
|
|
|
* |
|
437
|
|
|
* If no version is given, the current published version is used. |
|
438
|
|
|
* 4.x: The draft is created with the initialLanguage code of the source version or if not present with the main language. |
|
439
|
|
|
* It can be changed on updating the version. |
|
440
|
|
|
* |
|
441
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to create the draft |
|
442
|
|
|
* |
|
443
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
|
444
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
|
445
|
|
|
* @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 |
|
446
|
|
|
* |
|
447
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Content - the newly created content draft |
|
448
|
|
|
*/ |
|
449
|
|
|
public function createContentDraft(ContentInfo $contentInfo, VersionInfo $versionInfo = null, User $user = null) |
|
450
|
|
|
{ |
|
451
|
|
|
throw new \Exception('@todo: Implement.'); |
|
452
|
|
|
} |
|
453
|
|
|
|
|
454
|
|
|
/** |
|
455
|
|
|
* Loads drafts for a user. |
|
456
|
|
|
* |
|
457
|
|
|
* If no user is given the drafts for the authenticated user a returned |
|
458
|
|
|
* |
|
459
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to load the draft list |
|
460
|
|
|
* |
|
461
|
|
|
* @param \eZ\Publish\API\Repository\Values\User\User $user |
|
462
|
|
|
* |
|
463
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\VersionInfo the drafts ({@link VersionInfo}) owned by the given user |
|
464
|
|
|
*/ |
|
465
|
|
|
public function loadContentDrafts(User $user = null) |
|
466
|
|
|
{ |
|
467
|
|
|
throw new \Exception('@todo: Implement.'); |
|
468
|
|
|
} |
|
469
|
|
|
|
|
470
|
|
|
/** |
|
471
|
|
|
* Updates the fields of a draft. |
|
472
|
|
|
* |
|
473
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update this version |
|
474
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft |
|
475
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $contentUpdateStruct is not valid |
|
476
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is set to an empty value |
|
477
|
|
|
* |
|
478
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
|
479
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct $contentUpdateStruct |
|
480
|
|
|
* |
|
481
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Content the content draft with the updated fields |
|
482
|
|
|
*/ |
|
483
|
|
|
public function updateContent(VersionInfo $versionInfo, ContentUpdateStruct $contentUpdateStruct) |
|
484
|
|
|
{ |
|
485
|
|
|
throw new \Exception('@todo: Implement.'); |
|
486
|
|
|
} |
|
487
|
|
|
|
|
488
|
|
|
/** |
|
489
|
|
|
* Publishes a content version. |
|
490
|
|
|
* |
|
491
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to publish this version |
|
492
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft |
|
493
|
|
|
* |
|
494
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
|
495
|
|
|
* |
|
496
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Content |
|
497
|
|
|
* |
|
498
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to publish this version |
|
499
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft |
|
500
|
|
|
*/ |
|
501
|
|
|
public function publishVersion(VersionInfo $versionInfo) |
|
502
|
|
|
{ |
|
503
|
|
|
throw new \Exception('@todo: Implement.'); |
|
504
|
|
|
} |
|
505
|
|
|
|
|
506
|
|
|
/** |
|
507
|
|
|
* Removes the given version. |
|
508
|
|
|
* |
|
509
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is in |
|
510
|
|
|
* published state or is a last version of the Content |
|
511
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to remove this version |
|
512
|
|
|
* |
|
513
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
|
514
|
|
|
*/ |
|
515
|
|
|
public function deleteVersion(VersionInfo $versionInfo) |
|
516
|
|
|
{ |
|
517
|
|
|
throw new \Exception('@todo: Implement.'); |
|
518
|
|
|
} |
|
519
|
|
|
|
|
520
|
|
|
/** |
|
521
|
|
|
* Loads all versions for the given content. |
|
522
|
|
|
* |
|
523
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to list versions |
|
524
|
|
|
* |
|
525
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
|
526
|
|
|
* |
|
527
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\VersionInfo[] Sorted by creation date |
|
528
|
|
|
*/ |
|
529
|
|
|
public function loadVersions(ContentInfo $contentInfo) |
|
530
|
|
|
{ |
|
531
|
|
|
throw new \Exception('@todo: Implement.'); |
|
532
|
|
|
} |
|
533
|
|
|
|
|
534
|
|
|
/** |
|
535
|
|
|
* Copies the content to a new location. If no version is given, |
|
536
|
|
|
* all versions are copied, otherwise only the given version. |
|
537
|
|
|
* |
|
538
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to copy the content to the given location |
|
539
|
|
|
* |
|
540
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
|
541
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\LocationCreateStruct $destinationLocationCreateStruct the target location where the content is copied to |
|
542
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
|
543
|
|
|
* |
|
544
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Content |
|
545
|
|
|
*/ |
|
546
|
|
|
public function copyContent(ContentInfo $contentInfo, LocationCreateStruct $destinationLocationCreateStruct, VersionInfo $versionInfo = null) |
|
547
|
|
|
{ |
|
548
|
|
|
throw new \Exception('@todo: Implement.'); |
|
549
|
|
|
} |
|
550
|
|
|
|
|
551
|
|
|
/** |
|
552
|
|
|
* Finds content objects for the given query. |
|
553
|
|
|
* |
|
554
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\Query $query |
|
555
|
|
|
* @param array $languageFilter Configuration for specifying prioritized languages query will be performed on. |
|
556
|
|
|
* Currently supported: <code>array("languages" => array(<language1>,..))</code>. |
|
557
|
|
|
* @param bool $filterOnUserPermissions if true only the objects which is the user allowed to read are returned. |
|
558
|
|
|
* |
|
559
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\SearchResult |
|
560
|
|
|
*/ |
|
561
|
|
|
public function findContent(Query $query, array $languageFilter, $filterOnUserPermissions = true) |
|
|
|
|
|
|
562
|
|
|
{ |
|
563
|
|
|
throw new \Exception('@todo: Implement.'); |
|
564
|
|
|
} |
|
565
|
|
|
|
|
566
|
|
|
/** |
|
567
|
|
|
* Performs a query for a single content object. |
|
568
|
|
|
* |
|
569
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if the object was not found by the query or due to permissions |
|
570
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if the query would return more than one result |
|
571
|
|
|
* |
|
572
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\Query $query |
|
573
|
|
|
* @param array $languageFilter Configuration for specifying prioritized languages query will be performed on. |
|
574
|
|
|
* Currently supported: <code>array("languages" => array(<language1>,..))</code>. |
|
575
|
|
|
* @param bool $filterOnUserPermissions if true only the objects which is the user allowed to read are returned. |
|
576
|
|
|
* |
|
577
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Content |
|
578
|
|
|
*/ |
|
579
|
|
|
public function findSingle(Query $query, array $languageFilter, $filterOnUserPermissions = true) |
|
|
|
|
|
|
580
|
|
|
{ |
|
581
|
|
|
throw new \Exception('@todo: Implement.'); |
|
582
|
|
|
} |
|
583
|
|
|
|
|
584
|
|
|
/** |
|
585
|
|
|
* Loads all outgoing relations for the given version. |
|
586
|
|
|
* |
|
587
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read this version |
|
588
|
|
|
* |
|
589
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo |
|
590
|
|
|
* |
|
591
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Relation[] |
|
592
|
|
|
*/ |
|
593
|
|
|
public function loadRelations(VersionInfo $versionInfo) |
|
594
|
|
|
{ |
|
595
|
|
|
throw new \Exception('@todo: Implement.'); |
|
596
|
|
|
} |
|
597
|
|
|
|
|
598
|
|
|
/** |
|
599
|
|
|
* Loads all incoming relations for a content object. |
|
600
|
|
|
* |
|
601
|
|
|
* The relations come only |
|
602
|
|
|
* from published versions of the source content objects |
|
603
|
|
|
* |
|
604
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to read this version |
|
605
|
|
|
* |
|
606
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
|
607
|
|
|
* |
|
608
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Relation[] |
|
609
|
|
|
*/ |
|
610
|
|
|
public function loadReverseRelations(ContentInfo $contentInfo) |
|
611
|
|
|
{ |
|
612
|
|
|
throw new \Exception('@todo: Implement.'); |
|
613
|
|
|
} |
|
614
|
|
|
|
|
615
|
|
|
/** |
|
616
|
|
|
* Adds a relation of type common. |
|
617
|
|
|
* |
|
618
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to edit this version |
|
619
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft |
|
620
|
|
|
* |
|
621
|
|
|
* The source of the relation is the content and version |
|
622
|
|
|
* referenced by $versionInfo. |
|
623
|
|
|
* |
|
624
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $sourceVersion |
|
625
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContent the destination of the relation |
|
626
|
|
|
* |
|
627
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Relation the newly created relation |
|
628
|
|
|
*/ |
|
629
|
|
|
public function addRelation(VersionInfo $sourceVersion, ContentInfo $destinationContent) |
|
630
|
|
|
{ |
|
631
|
|
|
throw new \Exception('@todo: Implement.'); |
|
632
|
|
|
} |
|
633
|
|
|
|
|
634
|
|
|
/** |
|
635
|
|
|
* Removes a relation of type COMMON from a draft. |
|
636
|
|
|
* |
|
637
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed edit this version |
|
638
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the version is not a draft |
|
639
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if there is no relation of type COMMON for the given destination |
|
640
|
|
|
* |
|
641
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\VersionInfo $sourceVersion |
|
642
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContent |
|
643
|
|
|
*/ |
|
644
|
|
|
public function deleteRelation(VersionInfo $sourceVersion, ContentInfo $destinationContent) |
|
645
|
|
|
{ |
|
646
|
|
|
throw new \Exception('@todo: Implement.'); |
|
647
|
|
|
} |
|
648
|
|
|
|
|
649
|
|
|
/** |
|
650
|
|
|
* Instantiates a new content create struct object. |
|
651
|
|
|
* |
|
652
|
|
|
* alwaysAvailable is set to the ContentType's defaultAlwaysAvailable |
|
653
|
|
|
* |
|
654
|
|
|
* @param \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType |
|
655
|
|
|
* @param string $mainLanguageCode |
|
656
|
|
|
* |
|
657
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\ContentCreateStruct |
|
658
|
|
|
*/ |
|
659
|
|
|
public function newContentCreateStruct(ContentType $contentType, $mainLanguageCode) |
|
660
|
|
|
{ |
|
661
|
|
|
throw new \Exception('@todo: Implement.'); |
|
662
|
|
|
} |
|
663
|
|
|
|
|
664
|
|
|
/** |
|
665
|
|
|
* Instantiates a new content meta data update struct. |
|
666
|
|
|
* |
|
667
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct |
|
668
|
|
|
*/ |
|
669
|
|
|
public function newContentMetadataUpdateStruct() |
|
670
|
|
|
{ |
|
671
|
|
|
throw new \Exception('@todo: Implement.'); |
|
672
|
|
|
} |
|
673
|
|
|
|
|
674
|
|
|
/** |
|
675
|
|
|
* Instantiates a new content update struct. |
|
676
|
|
|
* |
|
677
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct |
|
678
|
|
|
*/ |
|
679
|
|
|
public function newContentUpdateStruct() |
|
680
|
|
|
{ |
|
681
|
|
|
throw new \Exception('@todo: Implement.'); |
|
682
|
|
|
} |
|
683
|
|
|
|
|
684
|
|
|
// Ignore this eZ Publish 5 feature by now. |
|
685
|
|
|
|
|
686
|
|
|
// @codeCoverageIgnoreStart |
|
687
|
|
|
|
|
688
|
|
|
/** |
|
689
|
|
|
* Translate a version. |
|
690
|
|
|
* |
|
691
|
|
|
* updates the destination version given in $translationInfo with the provided translated fields in $translationValues |
|
692
|
|
|
* |
|
693
|
|
|
* @example Examples/translation_5x.php |
|
694
|
|
|
* |
|
695
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to update this version |
|
696
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the given destination version is not a draft |
|
697
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\ContentValidationException if a required field is set to an empty value |
|
698
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException if a field in the $translationValues is not valid |
|
699
|
|
|
* |
|
700
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\TranslationInfo $translationInfo |
|
701
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\TranslationValues $translationValues |
|
702
|
|
|
* @param \eZ\Publish\API\Repository\Values\User\User $user If set, this user is taken as modifier of the version |
|
703
|
|
|
* |
|
704
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\Content the content draft with the translated fields |
|
705
|
|
|
* |
|
706
|
|
|
* @since 5.0 |
|
707
|
|
|
*/ |
|
708
|
|
|
public function translateVersion(TranslationInfo $translationInfo, TranslationValues $translationValues, User $user = null) |
|
709
|
|
|
{ |
|
710
|
|
|
throw new \Exception('@todo: Implement.'); |
|
711
|
|
|
} |
|
712
|
|
|
|
|
713
|
|
|
/** |
|
714
|
|
|
* Adds translation information to the content object. |
|
715
|
|
|
* |
|
716
|
|
|
* @example Examples/translation_5x.php |
|
717
|
|
|
* |
|
718
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed add a translation info |
|
719
|
|
|
* |
|
720
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\TranslationInfo $translationInfo |
|
721
|
|
|
* |
|
722
|
|
|
* @since 5.0 |
|
723
|
|
|
*/ |
|
724
|
|
|
public function addTranslationInfo(TranslationInfo $translationInfo) |
|
725
|
|
|
{ |
|
726
|
|
|
throw new \Exception('@todo: Implement.'); |
|
727
|
|
|
} |
|
728
|
|
|
|
|
729
|
|
|
/** |
|
730
|
|
|
* lists the translations done on this content object. |
|
731
|
|
|
* |
|
732
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed read translation infos |
|
733
|
|
|
* |
|
734
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
|
735
|
|
|
* @param array $filter |
|
736
|
|
|
* |
|
737
|
|
|
* @todo TBD - filter by sourceversion destination version and languages |
|
738
|
|
|
* |
|
739
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\TranslationInfo[] |
|
740
|
|
|
* |
|
741
|
|
|
* @since 5.0 |
|
742
|
|
|
*/ |
|
743
|
|
|
public function loadTranslationInfos(ContentInfo $contentInfo, array $filter = array()) |
|
744
|
|
|
{ |
|
745
|
|
|
throw new \Exception('@todo: Implement.'); |
|
746
|
|
|
} |
|
747
|
|
|
|
|
748
|
|
|
/** |
|
749
|
|
|
* Remove Content Object translation from all Versions (including archived ones) of a Content Object. |
|
750
|
|
|
* |
|
751
|
|
|
* NOTE: this operation is risky and permanent, so user interface (ideally CLI) should provide |
|
752
|
|
|
* a warning before performing it. |
|
753
|
|
|
* |
|
754
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\BadStateException if the specified translation |
|
755
|
|
|
* is the only one a Version has or it is the main translation of a Content Object. |
|
756
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed |
|
757
|
|
|
* to delete the content (in one of the locations of the given Content Object). |
|
758
|
|
|
* @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if languageCode argument |
|
759
|
|
|
* is invalid for the given content. |
|
760
|
|
|
* |
|
761
|
|
|
* @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo |
|
762
|
|
|
* @param string $languageCode |
|
763
|
|
|
* |
|
764
|
|
|
* @throws \Exception |
|
765
|
|
|
* |
|
766
|
|
|
* @since 6.11 |
|
767
|
|
|
*/ |
|
768
|
|
|
public function removeTranslation(ContentInfo $contentInfo, $languageCode) |
|
769
|
|
|
{ |
|
770
|
|
|
throw new \Exception('@todo: Implement.'); |
|
771
|
|
|
} |
|
772
|
|
|
|
|
773
|
|
|
/** |
|
774
|
|
|
* {@inheritdoc} |
|
775
|
|
|
*/ |
|
776
|
|
|
public function deleteTranslation(VersionInfo $versionInfo, $languageCode) |
|
777
|
|
|
{ |
|
778
|
|
|
throw new \Exception('@todo: Implement.'); |
|
779
|
|
|
} |
|
780
|
|
|
|
|
781
|
|
|
/** |
|
782
|
|
|
* Instantiates a new TranslationInfo object. |
|
783
|
|
|
* |
|
784
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\TranslationInfo |
|
785
|
|
|
*/ |
|
786
|
|
|
public function newTranslationInfo() |
|
787
|
|
|
{ |
|
788
|
|
|
throw new \Exception('@todo: Implement.'); |
|
789
|
|
|
} |
|
790
|
|
|
|
|
791
|
|
|
/** |
|
792
|
|
|
* Instantiates a Translation object. |
|
793
|
|
|
* |
|
794
|
|
|
* @return \eZ\Publish\API\Repository\Values\Content\TranslationValues |
|
795
|
|
|
*/ |
|
796
|
|
|
public function newTranslationValues() |
|
797
|
|
|
{ |
|
798
|
|
|
throw new \Exception('@todo: Implement.'); |
|
799
|
|
|
} |
|
800
|
|
|
} |
|
801
|
|
|
|
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.