diff --git a/bundle/Core/Exception/InvalidStateException.php b/bundle/Core/Exception/InvalidStateException.php index 714eda9..1d7713b 100644 --- a/bundle/Core/Exception/InvalidStateException.php +++ b/bundle/Core/Exception/InvalidStateException.php @@ -13,7 +13,7 @@ final class InvalidStateException extends Exception { public function __construct(Content $content, ?Exception $previous = null) { - $message = sprintf("Content '%s' with id #%d is not valid for scheduled visibility update.", $content->getName(), $content->getId()); + $message = sprintf("Content '%s' with id #%d is not valid for scheduled visibility update.", $content->getName(), $content->id); parent::__construct($message, 0, $previous); } diff --git a/bundle/Core/ScheduledVisibilityService.php b/bundle/Core/ScheduledVisibilityService.php index 93137df..de30c2a 100644 --- a/bundle/Core/ScheduledVisibilityService.php +++ b/bundle/Core/ScheduledVisibilityService.php @@ -165,7 +165,7 @@ private function logUpdate(Content $content, VisibilityUpdateResult $updateResul sprintf( "Content '%s' with id #%d has been %s.", $content->getName(), - $content->getId(), + $content->id, $updateResult->value, ), ); diff --git a/bundle/Core/VisibilityHandler/Content.php b/bundle/Core/VisibilityHandler/Content.php index a6195df..58c2cb0 100644 --- a/bundle/Core/VisibilityHandler/Content.php +++ b/bundle/Core/VisibilityHandler/Content.php @@ -19,24 +19,24 @@ public function __construct( public function hide(ContentValue $content): void { $this->repository->sudo( - fn () => $this->contentService->hideContent($content->getContentInfo()), + fn () => $this->contentService->hideContent($content->contentInfo), ); } public function reveal(ContentValue $content): void { $this->repository->sudo( - fn () => $this->contentService->revealContent($content->getContentInfo()), + fn () => $this->contentService->revealContent($content->contentInfo), ); } public function isHidden(ContentValue $content): bool { - return $content->getContentInfo()->isHidden(); + return $content->contentInfo->isHidden; } public function isVisible(ContentValue $content): bool { - return !$content->getContentInfo()->isHidden(); + return !$content->contentInfo->isHidden; } } diff --git a/bundle/Core/VisibilityHandler/Location.php b/bundle/Core/VisibilityHandler/Location.php index e8de929..76911d5 100644 --- a/bundle/Core/VisibilityHandler/Location.php +++ b/bundle/Core/VisibilityHandler/Location.php @@ -20,7 +20,7 @@ public function hide(Content $content): void { $this->repository->sudo( function () use ($content): void { - $locations = $this->locationService->loadLocations($content->getContentInfo()); + $locations = $this->locationService->loadLocations($content->contentInfo); foreach ($locations as $location) { $this->locationService->hideLocation($location); @@ -33,7 +33,7 @@ public function reveal(Content $content): void { $this->repository->sudo( function () use ($content): void { - $locations = $this->locationService->loadLocations($content->getContentInfo()); + $locations = $this->locationService->loadLocations($content->contentInfo); foreach ($locations as $location) { $this->locationService->unhideLocation($location); @@ -50,11 +50,12 @@ public function isHidden(Content $content): bool public function isVisible(Content $content): bool { $locations = $this->repository->sudo( - fn () => $this->locationService->loadLocations($content->getContentInfo()), + fn () => $this->locationService->loadLocations($content->contentInfo), ); + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ foreach ($locations as $location) { - if ($location->isHidden()) { + if ($location->hidden) { return false; } } diff --git a/bundle/Core/VisibilityHandler/ObjectState.php b/bundle/Core/VisibilityHandler/ObjectState.php index 8cc67ec..ec08c8e 100644 --- a/bundle/Core/VisibilityHandler/ObjectState.php +++ b/bundle/Core/VisibilityHandler/ObjectState.php @@ -57,7 +57,7 @@ function () use ($content, $objectStateId): void { $objectStateGroup = $objectState->getObjectStateGroup(); $this->objectStateService->setContentState( - $content->getContentInfo(), + $content->contentInfo, $objectStateGroup, $objectState, ); @@ -73,7 +73,7 @@ private function getObjectState(Content $content): ObjectStateValue function () use ($content, $objectStateGroupId): ObjectStateValue { $objectStateGroup = $this->objectStateService->loadObjectStateGroup($objectStateGroupId); - return $this->objectStateService->getContentState($content->getContentInfo(), $objectStateGroup); + return $this->objectStateService->getContentState($content->contentInfo, $objectStateGroup); }, ); } diff --git a/bundle/Core/VisibilityHandler/Section.php b/bundle/Core/VisibilityHandler/Section.php index fff6ec0..e77a09b 100644 --- a/bundle/Core/VisibilityHandler/Section.php +++ b/bundle/Core/VisibilityHandler/Section.php @@ -34,12 +34,12 @@ public function reveal(Content $content): void public function isHidden(Content $content): bool { - return $content->getContentInfo()->getSectionId() === $this->hiddenSectionId; + return $content->contentInfo->sectionId === $this->hiddenSectionId; } public function isVisible(Content $content): bool { - return $content->getContentInfo()->getSectionId() === $this->visibleSectionId; + return $content->contentInfo->sectionId === $this->visibleSectionId; } private function assignSection(Content $content, int $sectionId): void @@ -48,7 +48,7 @@ private function assignSection(Content $content, int $sectionId): void function () use ($content, $sectionId): void { $section = $this->sectionService->loadSection($sectionId); - $this->sectionService->assignSection($content->getContentInfo(), $section); + $this->sectionService->assignSection($content->contentInfo, $section); }, ); } diff --git a/tests/bundle/Integration/ContentAndLocationTest.php b/tests/bundle/Integration/ContentAndLocationTest.php index 0408911..b47ee34 100644 --- a/tests/bundle/Integration/ContentAndLocationTest.php +++ b/tests/bundle/Integration/ContentAndLocationTest.php @@ -24,7 +24,7 @@ public function testUpdateVisibility(array $configuration, bool $expectedHidden) if ($scheduledVisibilityService->shouldBeVisible($content) && $handler->isHidden($content)) { $handler->reveal($content); } - $content = $this->getRepository()->getContentService()->loadContent($content->getContentInfo()->getId()); + $content = $this->getRepository()->getContentService()->loadContent($content->contentInfo->id); self::assertEquals($handler->isHidden($content), $expectedHidden); } diff --git a/tests/bundle/Integration/ContentTest.php b/tests/bundle/Integration/ContentTest.php index caef23b..81fe460 100644 --- a/tests/bundle/Integration/ContentTest.php +++ b/tests/bundle/Integration/ContentTest.php @@ -22,7 +22,7 @@ public function testUpdateVisibility(array $configuration, bool $expectedHidden) if ($scheduledVisibilityService->shouldBeVisible($content) && $handler->isHidden($content)) { $handler->reveal($content); } - $content = $this->getRepository()->getContentService()->loadContent($content->getContentInfo()->getId()); + $content = $this->getRepository()->getContentService()->loadContent($content->contentInfo->id); self::assertEquals($handler->isHidden($content), $expectedHidden); } diff --git a/tests/bundle/Integration/LocationTest.php b/tests/bundle/Integration/LocationTest.php index 3b11dc5..37a86fe 100644 --- a/tests/bundle/Integration/LocationTest.php +++ b/tests/bundle/Integration/LocationTest.php @@ -22,7 +22,7 @@ public function testUpdateVisibility(array $configuration, bool $expectedHidden) if ($scheduledVisibilityService->shouldBeVisible($content) && $handler->isHidden($content)) { $handler->reveal($content); } - $content = $this->getRepository()->getContentService()->loadContent($content->getContentInfo()->getId()); + $content = $this->getRepository()->getContentService()->loadContent($content->contentInfo->id); self::assertEquals($handler->isHidden($content), $expectedHidden); } diff --git a/tests/bundle/Integration/ObjectStateTest.php b/tests/bundle/Integration/ObjectStateTest.php index aaaa110..de3b298 100644 --- a/tests/bundle/Integration/ObjectStateTest.php +++ b/tests/bundle/Integration/ObjectStateTest.php @@ -26,12 +26,12 @@ public function testUpdateVisibility(array $configuration, bool $expectedHidden) if ($scheduledVisibilityService->shouldBeVisible($content) && $handler->isHidden($content)) { $handler->reveal($content); } - $content = $this->getRepository()->getContentService()->loadContent($content->getContentInfo()->getId()); + $content = $this->getRepository()->getContentService()->loadContent($content->contentInfo->id); $objectStateService = $this->getRepository()->getObjectStateService(); $objectStateGroup = $objectStateService->loadObjectStateGroup(2); $objectState = $this->getRepository()->sudo( - static fn (): \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState => $objectStateService->getContentState($content->getContentInfo(), $objectStateGroup), + static fn (): ObjectStateValue => $objectStateService->getContentState($content->contentInfo, $objectStateGroup), ); self::assertEquals($objectState->id, $expectedHidden ? $hiddenObjectState->id : $visibleObjectStateId); } diff --git a/tests/bundle/Integration/SectionTest.php b/tests/bundle/Integration/SectionTest.php index 7262f2e..a325c58 100644 --- a/tests/bundle/Integration/SectionTest.php +++ b/tests/bundle/Integration/SectionTest.php @@ -25,8 +25,8 @@ public function testUpdateVisibility(array $configuration, bool $expectedHidden) if ($scheduledVisibilityService->shouldBeVisible($content) && $handler->isHidden($content)) { $handler->reveal($content); } - $content = $this->getRepository()->getContentService()->loadContent($content->getContentInfo()->getId()); - self::assertEquals($content->getContentInfo()->sectionId, $expectedHidden ? $hiddenSection->id : $visibleSectionId); + $content = $this->getRepository()->getContentService()->loadContent($content->contentInfo->id); + self::assertEquals($content->contentInfo->sectionId, $expectedHidden ? $hiddenSection->id : $visibleSectionId); } private function getSectionHandler(int $hiddenSectionId, int $visibleSectionId): Section