Skip to content

Commit

Permalink
[PHPDoc] Fixed ContentService publishing method @throws doc
Browse files Browse the repository at this point in the history
  • Loading branch information
alongosz committed Jun 27, 2024
1 parent 52beb2f commit a46adbc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
12 changes: 7 additions & 5 deletions src/contracts/Repository/ContentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,6 @@ public function updateContent(VersionInfo $versionInfo, ContentUpdateStruct $con
* Publishes a content version and deletes archive versions if they overflow max archive versions.
* Max archive versions are currently a configuration for default max limit, by default set to 5.
*
* @todo Introduce null|int ContentType->versionArchiveLimit to be able to let admins override this per type.
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException if the user is not allowed to publish this version
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException if the version is not a draft
*
* @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo
* @param string[] $translations List of language codes of translations which will be included
* in a published version.
Expand All @@ -354,6 +349,13 @@ public function updateContent(VersionInfo $versionInfo, ContentUpdateStruct $con
* overriding those in the current version.
*
* @return \Ibexa\Contracts\Core\Repository\Values\Content\Content
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException if the user is not allowed to publish this version
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException if the version is not a draft
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException
*/
public function publishVersion(VersionInfo $versionInfo, array $translations = Language::ALL): Content;

Expand Down
23 changes: 5 additions & 18 deletions src/lib/Repository/ContentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1449,22 +1449,6 @@ protected function internalUpdateContent(
);
}

/**
* Publishes a content version.
*
* Publishes a content version and deletes archive versions if they overflow max archive versions.
* Max archive versions are currently a configuration, but might be moved to be a param of ContentType in the future.
*
* @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo
* @param string[] $translations
*
* @return \Ibexa\Contracts\Core\Repository\Values\Content\Content
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException if the version is not a draft
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException
*/
public function publishVersion(APIVersionInfo $versionInfo, array $translations = Language::ALL): APIContent
{
$content = $this->internalLoadContentById(
Expand Down Expand Up @@ -1721,13 +1705,16 @@ protected function fieldValuesAreEqual(FieldType $fieldType, Value $value1, Valu
* Publishes a content version and deletes archive versions if they overflow max archive versions.
* Max archive versions are currently a configuration, but might be moved to be a param of ContentType in the future.
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException if the version is not a draft
*
* @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo
* @param int|null $publicationDate If null existing date is kept if there is one, otherwise current time is used.
* @param string[] $translations
*
* @return \Ibexa\Contracts\Core\Repository\Values\Content\Content
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException if the version is not a draft
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException
*/
protected function internalPublishVersion(APIVersionInfo $versionInfo, $publicationDate = null, array $translations = Language::ALL)
{
Expand Down

0 comments on commit a46adbc

Please sign in to comment.