From 89a9cdf762150159793ad5706af54f8ed4d0059c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Mon, 8 Jun 2026 13:02:05 +0200 Subject: [PATCH 01/10] composer require ibexa/messenger:~6.0.x-dev --- composer.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/composer.json b/composer.json index ea191ee9..1c0ea8c4 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "name": "ibexa/content-forms", "description": "Use Symfony Forms with Ibexa Content & User objects", + "minimum-stability": "dev", "license": "(GPL-2.0-only or proprietary)", "type": "ibexa-bundle", "replace": { @@ -10,6 +11,7 @@ "php": " >=8.3", "ext-json": "*", "ibexa/core": "~6.0.x-dev", + "ibexa/messenger": "~6.0.x-dev", "symfony/config": "^7.4", "symfony/dependency-injection": "^7.4", "symfony/event-dispatcher": "^7.4", From faf6f578b788bc8b24a1c4f6f410eda61865dfe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Mon, 8 Jun 2026 13:02:34 +0200 Subject: [PATCH 02/10] Split point for sync/async paths in ContentFormProcessor --- src/bundle/Resources/config/services.yaml | 1 + .../Form/Processor/ContentFormProcessor.php | 36 ++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/bundle/Resources/config/services.yaml b/src/bundle/Resources/config/services.yaml index f2b92354..fa5953fb 100644 --- a/src/bundle/Resources/config/services.yaml +++ b/src/bundle/Resources/config/services.yaml @@ -58,6 +58,7 @@ services: - '@ibexa.api.service.content' - '@ibexa.api.service.location' - '@router' + - '@ibexa.messenger.bus' tags: - { name: kernel.event_subscriber } diff --git a/src/lib/Form/Processor/ContentFormProcessor.php b/src/lib/Form/Processor/ContentFormProcessor.php index 0222971f..0df18e59 100644 --- a/src/lib/Form/Processor/ContentFormProcessor.php +++ b/src/lib/Form/Processor/ContentFormProcessor.php @@ -8,6 +8,7 @@ namespace Ibexa\ContentForms\Form\Processor; +use Ibexa\Bundle\Core\Message\PublishContentAsync; use Ibexa\ContentForms\Data\Content\ContentCreateData; use Ibexa\ContentForms\Data\Content\ContentUpdateData; use Ibexa\ContentForms\Data\NewnessCheckable; @@ -22,6 +23,7 @@ use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\RouterInterface; @@ -33,7 +35,8 @@ public function __construct( private ContentService $contentService, private LocationService $locationService, - private RouterInterface $router + private RouterInterface $router, + private MessageBusInterface $bus, ) { } @@ -150,10 +153,35 @@ public function processPublish(FormActionEvent $event): void $draft = $this->saveDraft($data, $form->getConfig()->getOption('languageCode')); $versionInfo = $draft->getVersionInfo(); - $content = $this->contentService->publishVersion( - $versionInfo, - [$versionInfo->getInitialLanguage()->getLanguageCode()] + + /** todo splitting sync/async extension point + * possible extension options based on yaml-configured flag: + * - if-conditioning in code (like atm hardcoded solution) + * - if-subscribers methods + * - if-subscribers + * - messenger routing to dispatching sync/async message (consistent flow with no code conditioning logic - all depends on message's messenger routing config) + * - extract publish content service (\Ibexa\Core\Repository\ContentService::publishVersion) and decorate it with async service + * prons: simplified call-sade, no conditioning + * cons: calling-side not aware of sync/async path + * todo cover also all other sync publish paths + */ + + // todo old sync implementation +// $content = $this->contentService->publishVersion( +// $versionInfo, +// [$versionInfo->getInitialLanguage()->getLanguageCode()] +// ); + + // todo new async dispatching + $this->bus->dispatch( + new PublishContentAsync( + $versionInfo->getContentInfo()->id, + $versionInfo->versionNo, + [$versionInfo->getInitialLanguage()->getLanguageCode()], + ), ); + // all further dependencies in this path are not content publishing state dependent + $content = $draft; $event->setPayload('content', $content); $event->setPayload('is_new', $draft->getContentInfo()->isDraft()); From 8c2305b7ae02120d8d9cd3a36dd028f775e80007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Mon, 8 Jun 2026 13:16:47 +0200 Subject: [PATCH 03/10] [TMP] Added dependencies.json file --- dependencies.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 dependencies.json diff --git a/dependencies.json b/dependencies.json new file mode 100644 index 00000000..1321c2be --- /dev/null +++ b/dependencies.json @@ -0,0 +1,11 @@ +{ + "recipesEndpoint": "", + "packages": [ + { + "requirement": "dev-IBX-11780-async-content-publishing-spike as 6.0.x-dev", + "repositoryUrl": "https://github.com/ibexa/core", + "package": "ibexa/core", + "shouldBeAddedAsVCS": false + } + ] +} \ No newline at end of file From 6118710232544bdee5185f40fede3166afd7680c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Mon, 8 Jun 2026 15:38:04 +0200 Subject: [PATCH 04/10] Adjusted backend CI workflows --- .github/workflows/backend-ci.yaml | 75 ++++++++++++++----------------- 1 file changed, 33 insertions(+), 42 deletions(-) diff --git a/.github/workflows/backend-ci.yaml b/.github/workflows/backend-ci.yaml index 892eac04..39ca160a 100644 --- a/.github/workflows/backend-ci.yaml +++ b/.github/workflows/backend-ci.yaml @@ -17,20 +17,17 @@ jobs: - '8.3' steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - extensions: 'pdo_sqlite, gd' - tools: cs2pr + - uses: ibexa/gh-workflows/actions/composer-install@main + with: + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} + satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }} - - uses: ./.github/actions/composer-install - - - name: Run code style check - run: composer run-script check-cs -- --format=checkstyle | cs2pr + - name: Run code style check + run: composer run-script check-cs -- --format=checkstyle | cs2pr tests: name: Unit tests & PHPStan static analysis @@ -45,26 +42,23 @@ jobs: - '8.4' steps: - - uses: actions/checkout@v5 - - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - extensions: pdo_sqlite, gd - tools: cs2pr + - uses: actions/checkout@v6 - - uses: ./.github/actions/composer-install + - uses: ibexa/gh-workflows/actions/composer-install@main + with: + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} + satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }} - - name: Setup problem matchers for PHPUnit - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - name: Run unit test suite - run: composer test + - name: Run unit test suite + run: composer test - - name: Run PHPStan analysis - run: composer run-script phpstan + - name: Run PHPStan analysis + run: composer run-script phpstan integration-tests: name: Runs integration tests @@ -80,20 +74,17 @@ jobs: - '8.4' steps: - - uses: actions/checkout@v5 - - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - extensions: pdo_sqlite, gd - tools: cs2pr + - uses: actions/checkout@v6 - - uses: ./.github/actions/composer-install + - uses: ibexa/gh-workflows/actions/composer-install@main + with: + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + satis-network-key: ${{ secrets.SATIS_NETWORK_KEY }} + satis-network-token: ${{ secrets.SATIS_NETWORK_TOKEN }} - - name: Setup problem matchers for PHPUnit - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - name: Run unit test suite - run: composer run-script test-integration + - name: Run unit test suite + run: composer run-script test-integration From 16a06a140092ea6f7e36cd0e88b676cc54a16760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Tue, 9 Jun 2026 07:36:34 +0200 Subject: [PATCH 05/10] Added missing messenger bundle in integration tests --- tests/integration/Kernel.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/integration/Kernel.php b/tests/integration/Kernel.php index cd9309b7..6a8f0d6e 100644 --- a/tests/integration/Kernel.php +++ b/tests/integration/Kernel.php @@ -9,6 +9,7 @@ namespace Ibexa\Tests\Integration\ContentForms; use Ibexa\Bundle\ContentForms\IbexaContentFormsBundle; +use Ibexa\Bundle\Messenger\IbexaMessengerBundle; use Ibexa\Contracts\Test\Core\IbexaTestKernel; use Symfony\Component\Config\Loader\LoaderInterface; @@ -19,6 +20,7 @@ public function registerBundles(): iterable yield from parent::registerBundles(); yield new IbexaContentFormsBundle(); + yield new IbexaMessengerBundle(); } public function registerContainerConfiguration(LoaderInterface $loader): void From 65fe7447e4a5eec329dbf2214f6c7da77bf78ae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Tue, 9 Jun 2026 08:47:15 +0200 Subject: [PATCH 06/10] Used `async_content_publish` repository config to determine sync/async content publication path --- src/bundle/Resources/config/services.yaml | 1 + .../Form/Processor/ContentFormProcessor.php | 37 +++++++++++-------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/bundle/Resources/config/services.yaml b/src/bundle/Resources/config/services.yaml index fa5953fb..d71dd973 100644 --- a/src/bundle/Resources/config/services.yaml +++ b/src/bundle/Resources/config/services.yaml @@ -59,6 +59,7 @@ services: - '@ibexa.api.service.location' - '@router' - '@ibexa.messenger.bus' + - '@Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface' tags: - { name: kernel.event_subscriber } diff --git a/src/lib/Form/Processor/ContentFormProcessor.php b/src/lib/Form/Processor/ContentFormProcessor.php index 0df18e59..4d1731eb 100644 --- a/src/lib/Form/Processor/ContentFormProcessor.php +++ b/src/lib/Form/Processor/ContentFormProcessor.php @@ -14,6 +14,7 @@ use Ibexa\ContentForms\Data\NewnessCheckable; use Ibexa\ContentForms\Event\ContentFormEvents; use Ibexa\ContentForms\Event\FormActionEvent; +use Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; @@ -37,6 +38,7 @@ public function __construct( private LocationService $locationService, private RouterInterface $router, private MessageBusInterface $bus, + private RepositoryConfigurationProviderInterface $repositoryConfigurationProvider, ) { } @@ -166,22 +168,22 @@ public function processPublish(FormActionEvent $event): void * todo cover also all other sync publish paths */ - // todo old sync implementation -// $content = $this->contentService->publishVersion( -// $versionInfo, -// [$versionInfo->getInitialLanguage()->getLanguageCode()] -// ); - - // todo new async dispatching - $this->bus->dispatch( - new PublishContentAsync( - $versionInfo->getContentInfo()->id, - $versionInfo->versionNo, + if ($this->isAsyncContentPublishEnabled()) { + $this->bus->dispatch( + new PublishContentAsync( + $versionInfo->getContentInfo()->id, + $versionInfo->versionNo, + [$versionInfo->getInitialLanguage()->getLanguageCode()], + ), + ); + // all further dependencies in this path are not content publishing state dependent + $content = $draft; + } else { + $content = $this->contentService->publishVersion( + $versionInfo, [$versionInfo->getInitialLanguage()->getLanguageCode()], - ), - ); - // all further dependencies in this path are not content publishing state dependent - $content = $draft; + ); + } $event->setPayload('content', $content); $event->setPayload('is_new', $draft->getContentInfo()->isDraft()); @@ -203,6 +205,11 @@ public function processPublish(FormActionEvent $event): void $event->setResponse(new RedirectResponse($redirectUrl)); } + private function isAsyncContentPublishEnabled(): bool + { + return (bool) ($this->repositoryConfigurationProvider->getRepositoryConfig()['async_content_publish'] ?? false); + } + /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException From 9a854afbd0ed67d0e43e67b8c6c3735e3aa6b301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Tue, 9 Jun 2026 08:49:48 +0200 Subject: [PATCH 07/10] Fixed code styles --- src/lib/Form/Processor/ContentFormProcessor.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib/Form/Processor/ContentFormProcessor.php b/src/lib/Form/Processor/ContentFormProcessor.php index 4d1731eb..648a50a3 100644 --- a/src/lib/Form/Processor/ContentFormProcessor.php +++ b/src/lib/Form/Processor/ContentFormProcessor.php @@ -167,7 +167,6 @@ public function processPublish(FormActionEvent $event): void * cons: calling-side not aware of sync/async path * todo cover also all other sync publish paths */ - if ($this->isAsyncContentPublishEnabled()) { $this->bus->dispatch( new PublishContentAsync( From 903661c1dcf00ec08c2c10557568443019bdad9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Wed, 10 Jun 2026 13:45:38 +0200 Subject: [PATCH 08/10] Used AsyncPublicationService in ContentFormProcessor --- src/bundle/Resources/config/services.yaml | 2 +- src/lib/Form/Processor/ContentFormProcessor.php | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/bundle/Resources/config/services.yaml b/src/bundle/Resources/config/services.yaml index d71dd973..6fecd8d6 100644 --- a/src/bundle/Resources/config/services.yaml +++ b/src/bundle/Resources/config/services.yaml @@ -58,8 +58,8 @@ services: - '@ibexa.api.service.content' - '@ibexa.api.service.location' - '@router' - - '@ibexa.messenger.bus' - '@Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface' + - '@Ibexa\Core\Repository\ContentService\AsyncPublicationService' tags: - { name: kernel.event_subscriber } diff --git a/src/lib/Form/Processor/ContentFormProcessor.php b/src/lib/Form/Processor/ContentFormProcessor.php index 648a50a3..68cdb3a2 100644 --- a/src/lib/Form/Processor/ContentFormProcessor.php +++ b/src/lib/Form/Processor/ContentFormProcessor.php @@ -8,7 +8,6 @@ namespace Ibexa\ContentForms\Form\Processor; -use Ibexa\Bundle\Core\Message\PublishContentAsync; use Ibexa\ContentForms\Data\Content\ContentCreateData; use Ibexa\ContentForms\Data\Content\ContentUpdateData; use Ibexa\ContentForms\Data\NewnessCheckable; @@ -22,9 +21,9 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\Repository\ContentService\AsyncPublicationService; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\Messenger\MessageBusInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\RouterInterface; @@ -37,8 +36,8 @@ public function __construct( private ContentService $contentService, private LocationService $locationService, private RouterInterface $router, - private MessageBusInterface $bus, private RepositoryConfigurationProviderInterface $repositoryConfigurationProvider, + private AsyncPublicationService $asyncPublicationService, ) { } @@ -168,13 +167,12 @@ public function processPublish(FormActionEvent $event): void * todo cover also all other sync publish paths */ if ($this->isAsyncContentPublishEnabled()) { - $this->bus->dispatch( - new PublishContentAsync( - $versionInfo->getContentInfo()->id, - $versionInfo->versionNo, - [$versionInfo->getInitialLanguage()->getLanguageCode()], - ), + $this->asyncPublicationService->registerPublication( + $versionInfo->getContentInfo()->id, + $versionInfo->versionNo, + [$versionInfo->getInitialLanguage()->getLanguageCode()], ); + // all further dependencies in this path are not content publishing state dependent $content = $draft; } else { From 209831a60e0ff0c392384df4f64054be7ecbed8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Thu, 18 Jun 2026 13:23:48 +0200 Subject: [PATCH 09/10] Refactored \Ibexa\ContentForms\Form\Processor\ContentFormProcessor::processPublish (and further code) to not depend on published content item --- src/bundle/Resources/config/services.yaml | 1 + .../Form/Processor/ContentFormProcessor.php | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/bundle/Resources/config/services.yaml b/src/bundle/Resources/config/services.yaml index 6fecd8d6..0d75ad51 100644 --- a/src/bundle/Resources/config/services.yaml +++ b/src/bundle/Resources/config/services.yaml @@ -60,6 +60,7 @@ services: - '@router' - '@Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface' - '@Ibexa\Core\Repository\ContentService\AsyncPublicationService' + - '@ibexa.config.resolver' tags: - { name: kernel.event_subscriber } diff --git a/src/lib/Form/Processor/ContentFormProcessor.php b/src/lib/Form/Processor/ContentFormProcessor.php index 68cdb3a2..a2942a56 100644 --- a/src/lib/Form/Processor/ContentFormProcessor.php +++ b/src/lib/Form/Processor/ContentFormProcessor.php @@ -20,6 +20,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentStruct; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; +use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\Repository\ContentService\AsyncPublicationService; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -38,6 +39,7 @@ public function __construct( private RouterInterface $router, private RepositoryConfigurationProviderInterface $repositoryConfigurationProvider, private AsyncPublicationService $asyncPublicationService, + private ConfigResolverInterface $configResolver, ) { } @@ -173,30 +175,31 @@ public function processPublish(FormActionEvent $event): void [$versionInfo->getInitialLanguage()->getLanguageCode()], ); - // all further dependencies in this path are not content publishing state dependent - $content = $draft; } else { - $content = $this->contentService->publishVersion( + $this->contentService->publishVersion( $versionInfo, [$versionInfo->getInitialLanguage()->getLanguageCode()], ); } - $event->setPayload('content', $content); + $event->setPayload('content_type', $draft->getContentType()); $event->setPayload('is_new', $draft->getContentInfo()->isDraft()); - $locationId = $referrerLocation !== null && $data instanceof ContentUpdateData - ? $referrerLocation->id - : $content->getContentInfo()->getMainLocationId(); + if ($referrerLocation !== null && $data instanceof ContentUpdateData) { + $locationId = $referrerLocation->id; + $contentId = $draft->getContentInfo()->id; + } else { + $locationId = (int) $this->configResolver->getParameter('location_ids.content_structure'); + $contentId = $this->locationService->loadLocation($locationId)->getContentId(); + } - $contentId = $content->getId(); $redirectUrl = $form['redirectUrlAfterPublish']->getData() ?: $this->router->generate( 'ibexa.content.view', [ 'contentId' => $contentId, 'locationId' => $locationId, 'publishedContentId' => $contentId, - ] + ], ); $event->setResponse(new RedirectResponse($redirectUrl)); From 9f5f6cfd176a4571e21ebe019e96592459452442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Thu, 18 Jun 2026 14:38:07 +0200 Subject: [PATCH 10/10] Simplified content publication by using ContentPublisherInterface (sync/async resolved internally) --- src/bundle/Resources/config/services.yaml | 3 +- .../Form/Processor/ContentFormProcessor.php | 39 +++---------------- 2 files changed, 7 insertions(+), 35 deletions(-) diff --git a/src/bundle/Resources/config/services.yaml b/src/bundle/Resources/config/services.yaml index 0d75ad51..cdfc0660 100644 --- a/src/bundle/Resources/config/services.yaml +++ b/src/bundle/Resources/config/services.yaml @@ -58,8 +58,7 @@ services: - '@ibexa.api.service.content' - '@ibexa.api.service.location' - '@router' - - '@Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface' - - '@Ibexa\Core\Repository\ContentService\AsyncPublicationService' + - '@Ibexa\Contracts\Core\Repository\ContentPublisherInterface' - '@ibexa.config.resolver' tags: - { name: kernel.event_subscriber } diff --git a/src/lib/Form/Processor/ContentFormProcessor.php b/src/lib/Form/Processor/ContentFormProcessor.php index a2942a56..86a06951 100644 --- a/src/lib/Form/Processor/ContentFormProcessor.php +++ b/src/lib/Form/Processor/ContentFormProcessor.php @@ -13,7 +13,7 @@ use Ibexa\ContentForms\Data\NewnessCheckable; use Ibexa\ContentForms\Event\ContentFormEvents; use Ibexa\ContentForms\Event\FormActionEvent; -use Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface; +use Ibexa\Contracts\Core\Repository\ContentPublisherInterface; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; @@ -22,7 +22,6 @@ use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; -use Ibexa\Core\Repository\ContentService\AsyncPublicationService; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; @@ -37,8 +36,7 @@ public function __construct( private ContentService $contentService, private LocationService $locationService, private RouterInterface $router, - private RepositoryConfigurationProviderInterface $repositoryConfigurationProvider, - private AsyncPublicationService $asyncPublicationService, + private ContentPublisherInterface $contentPublisher, private ConfigResolverInterface $configResolver, ) { } @@ -157,30 +155,10 @@ public function processPublish(FormActionEvent $event): void $draft = $this->saveDraft($data, $form->getConfig()->getOption('languageCode')); $versionInfo = $draft->getVersionInfo(); - /** todo splitting sync/async extension point - * possible extension options based on yaml-configured flag: - * - if-conditioning in code (like atm hardcoded solution) - * - if-subscribers methods - * - if-subscribers - * - messenger routing to dispatching sync/async message (consistent flow with no code conditioning logic - all depends on message's messenger routing config) - * - extract publish content service (\Ibexa\Core\Repository\ContentService::publishVersion) and decorate it with async service - * prons: simplified call-sade, no conditioning - * cons: calling-side not aware of sync/async path - * todo cover also all other sync publish paths - */ - if ($this->isAsyncContentPublishEnabled()) { - $this->asyncPublicationService->registerPublication( - $versionInfo->getContentInfo()->id, - $versionInfo->versionNo, - [$versionInfo->getInitialLanguage()->getLanguageCode()], - ); - - } else { - $this->contentService->publishVersion( - $versionInfo, - [$versionInfo->getInitialLanguage()->getLanguageCode()], - ); - } + $this->contentPublisher->publishVersion( + $versionInfo, + [$versionInfo->getInitialLanguage()->getLanguageCode()], + ); $event->setPayload('content_type', $draft->getContentType()); $event->setPayload('is_new', $draft->getContentInfo()->isDraft()); @@ -205,11 +183,6 @@ public function processPublish(FormActionEvent $event): void $event->setResponse(new RedirectResponse($redirectUrl)); } - private function isAsyncContentPublishEnabled(): bool - { - return (bool) ($this->repositoryConfigurationProvider->getRepositoryConfig()['async_content_publish'] ?? false); - } - /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException