|
@@ 312-328 (lines=17) @@
|
| 309 |
|
* |
| 310 |
|
* @return \eZ\Publish\Core\REST\Server\Values\NoContent |
| 311 |
|
*/ |
| 312 |
|
public function deleteContentVersion($contentId, $versionNumber) |
| 313 |
|
{ |
| 314 |
|
$versionInfo = $this->repository->getContentService()->loadVersionInfo( |
| 315 |
|
$this->repository->getContentService()->loadContentInfo($contentId), |
| 316 |
|
$versionNumber |
| 317 |
|
); |
| 318 |
|
|
| 319 |
|
if ($versionInfo->status === VersionInfo::STATUS_PUBLISHED) { |
| 320 |
|
throw new ForbiddenException('Version in status PUBLISHED cannot be deleted'); |
| 321 |
|
} |
| 322 |
|
|
| 323 |
|
$this->repository->getContentService()->deleteVersion( |
| 324 |
|
$versionInfo |
| 325 |
|
); |
| 326 |
|
|
| 327 |
|
return new Values\NoContent(); |
| 328 |
|
} |
| 329 |
|
|
| 330 |
|
/** |
| 331 |
|
* The system creates a new draft version as a copy from the given version. |
|
@@ 471-487 (lines=17) @@
|
| 468 |
|
* |
| 469 |
|
* @return \eZ\Publish\Core\REST\Server\Values\NoContent |
| 470 |
|
*/ |
| 471 |
|
public function publishVersion($contentId, $versionNumber) |
| 472 |
|
{ |
| 473 |
|
$versionInfo = $this->repository->getContentService()->loadVersionInfo( |
| 474 |
|
$this->repository->getContentService()->loadContentInfo($contentId), |
| 475 |
|
$versionNumber |
| 476 |
|
); |
| 477 |
|
|
| 478 |
|
if ($versionInfo->status !== VersionInfo::STATUS_DRAFT) { |
| 479 |
|
throw new ForbiddenException('Only version in status DRAFT can be published'); |
| 480 |
|
} |
| 481 |
|
|
| 482 |
|
$this->repository->getContentService()->publishVersion( |
| 483 |
|
$versionInfo |
| 484 |
|
); |
| 485 |
|
|
| 486 |
|
return new Values\NoContent(); |
| 487 |
|
} |
| 488 |
|
|
| 489 |
|
/** |
| 490 |
|
* Redirects to the relations of the current version. |