Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use ApiPlatform\OpenApi\Model;
use Ibexa\Contracts\Core\Repository\ContentService;
use Ibexa\Contracts\Core\Repository\Values\Content\Relation;
use Ibexa\Contracts\Core\Repository\Values\Content\RelationType;
use Ibexa\Contracts\Rest\Exceptions;
use Ibexa\Rest\Server\Controller as RestController;
use Ibexa\Rest\Server\Exceptions\ForbiddenException;
Expand Down Expand Up @@ -95,7 +96,7 @@ public function removeRelation(int $contentId, int $versionNumber, int $relation

foreach ($versionRelations as $relation) {
if ($relation->id == $relationId) {
if ($relation->type !== Relation::COMMON) {
if ($relation->type !== RelationType::COMMON->value) {
throw new ForbiddenException('Relation is not of type COMMON');
}

Expand Down
12 changes: 6 additions & 6 deletions src/lib/Server/Output/ValueObjectVisitor/RestRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Ibexa\Rest\Server\Output\ValueObjectVisitor;

use Ibexa\Contracts\Core\Repository\Values\Content\Relation as RelationValue;
use Ibexa\Contracts\Core\Repository\Values\Content\RelationType;
use Ibexa\Contracts\Rest\Output\Generator;
use Ibexa\Contracts\Rest\Output\ValueObjectVisitor;
use Ibexa\Contracts\Rest\Output\Visitor;
Expand Down Expand Up @@ -92,19 +92,19 @@ protected function getRelationTypeString($relationType)
{
$relationTypeList = [];

if (RelationValue::COMMON & $relationType) {
if (RelationType::COMMON->value & $relationType) {
$relationTypeList[] = 'COMMON';
}
if (RelationValue::EMBED & $relationType) {
if (RelationType::EMBED->value & $relationType) {
$relationTypeList[] = 'EMBED';
}
if (RelationValue::LINK & $relationType) {
if (RelationType::LINK->value & $relationType) {
$relationTypeList[] = 'LINK';
}
if (RelationValue::FIELD & $relationType) {
if (RelationType::FIELD->value & $relationType) {
$relationTypeList[] = 'ATTRIBUTE';
}
if (RelationValue::ASSET & $relationType) {
if (RelationType::ASSET->value & $relationType) {
$relationTypeList[] = 'ASSET';
}

Expand Down
Loading