|
@@ 347-363 (lines=17) @@
|
| 344 |
|
* |
| 345 |
|
* @return \eZ\Publish\Core\REST\Server\Values\NoContent |
| 346 |
|
*/ |
| 347 |
|
public function deleteContentVersion($contentId, $versionNumber) |
| 348 |
|
{ |
| 349 |
|
$versionInfo = $this->repository->getContentService()->loadVersionInfo( |
| 350 |
|
$this->repository->getContentService()->loadContentInfo($contentId), |
| 351 |
|
$versionNumber |
| 352 |
|
); |
| 353 |
|
|
| 354 |
|
if ($versionInfo->isPublished()) { |
| 355 |
|
throw new ForbiddenException('Version in status PUBLISHED cannot be deleted'); |
| 356 |
|
} |
| 357 |
|
|
| 358 |
|
$this->repository->getContentService()->deleteVersion( |
| 359 |
|
$versionInfo |
| 360 |
|
); |
| 361 |
|
|
| 362 |
|
return new Values\NoContent(); |
| 363 |
|
} |
| 364 |
|
|
| 365 |
|
/** |
| 366 |
|
* Remove the given Translation of the given published Version and publish new one. |
|
@@ 555-571 (lines=17) @@
|
| 552 |
|
* |
| 553 |
|
* @return \eZ\Publish\Core\REST\Server\Values\NoContent |
| 554 |
|
*/ |
| 555 |
|
public function publishVersion($contentId, $versionNumber) |
| 556 |
|
{ |
| 557 |
|
$versionInfo = $this->repository->getContentService()->loadVersionInfo( |
| 558 |
|
$this->repository->getContentService()->loadContentInfo($contentId), |
| 559 |
|
$versionNumber |
| 560 |
|
); |
| 561 |
|
|
| 562 |
|
if (!$versionInfo->isDraft()) { |
| 563 |
|
throw new ForbiddenException('Only version in status DRAFT can be published'); |
| 564 |
|
} |
| 565 |
|
|
| 566 |
|
$this->repository->getContentService()->publishVersion( |
| 567 |
|
$versionInfo |
| 568 |
|
); |
| 569 |
|
|
| 570 |
|
return new Values\NoContent(); |
| 571 |
|
} |
| 572 |
|
|
| 573 |
|
/** |
| 574 |
|
* Redirects to the relations of the current version. |