Skip to content
Draft
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
@@ -0,0 +1,24 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Bundle\Core\DependencyInjection\Configuration\Parser\Repository;

use Ibexa\Bundle\Core\DependencyInjection\Configuration\RepositoryConfigParserInterface;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

final class AsyncContentPublish implements RepositoryConfigParserInterface
{
public function addSemanticConfig(NodeBuilder $nodeBuilder): void
{
$nodeBuilder
->booleanNode('async_content_publish')
->defaultFalse()
->info('Enables asynchronous content publishing.')
->end();
}
}
1 change: 1 addition & 0 deletions src/bundle/Core/IbexaCoreBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public function getContainerExtension(): ExtensionInterface
new ConfigParser\Embeddings(),
],
[
new RepositoryConfigParser\AsyncContentPublish(),
new RepositoryConfigParser\Storage(),
new RepositoryConfigParser\Search(),
new RepositoryConfigParser\FieldGroups(),
Expand Down
22 changes: 22 additions & 0 deletions src/bundle/Core/Message/PublishContentAsync.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Bundle\Core\Message;

use Ibexa\Contracts\Core\Repository\Values\Content\Language;

final readonly class PublishContentAsync
{
public function __construct(
public int $contentId,
public int $versionNo,
/** @var list<string> */
public array $translations = Language::ALL,
) {
}
}
31 changes: 31 additions & 0 deletions src/bundle/Core/Message/PublishContentAsyncHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Bundle\Core\Message;

use Ibexa\Contracts\Core\Repository\ContentService;

final class PublishContentAsyncHandler
{
public function __construct(
private ContentService $contentService,
) {
}

public function __invoke(PublishContentAsync $message): void
{
$versionInfo = $this->contentService->loadVersionInfoById($message->contentId, $message->versionNo);

$this->contentService->publishVersion(
$versionInfo,
[$versionInfo->getInitialLanguage()->getLanguageCode()],
);

// todo handle "publishing in progress" status

Check warning on line 29 in src/bundle/Core/Message/PublishContentAsyncHandler.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=ibexa_core&issues=AZ6m9FMvSL4mV-gKOIqU&open=AZ6m9FMvSL4mV-gKOIqU&pullRequest=761
}
}
21 changes: 21 additions & 0 deletions src/bundle/Core/Messenger/MessageProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Bundle\Core\Messenger;

use Ibexa\Bundle\Core\Message\PublishContentAsync;
// TODO circular dependency on ibexa/messenger !!!

Check warning on line 12 in src/bundle/Core/Messenger/MessageProvider.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=ibexa_core&issues=AZ6nbrI31ZpgcrbOOxmI&open=AZ6nbrI31ZpgcrbOOxmI&pullRequest=761
use Ibexa\Contracts\Messenger\Transport\MessageProviderInterface;

final class MessageProvider implements MessageProviderInterface

Check failure on line 15 in src/bundle/Core/Messenger/MessageProvider.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.4)

Class Ibexa\Bundle\Core\Messenger\MessageProvider implements unknown interface Ibexa\Contracts\Messenger\Transport\MessageProviderInterface.

Check failure on line 15 in src/bundle/Core/Messenger/MessageProvider.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.3)

Class Ibexa\Bundle\Core\Messenger\MessageProvider implements unknown interface Ibexa\Contracts\Messenger\Transport\MessageProviderInterface.
{
public function getHandledClasses(): iterable

Check failure on line 17 in src/bundle/Core/Messenger/MessageProvider.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.4)

Method Ibexa\Bundle\Core\Messenger\MessageProvider::getHandledClasses() return type has no value type specified in iterable type iterable.

Check failure on line 17 in src/bundle/Core/Messenger/MessageProvider.php

View workflow job for this annotation

GitHub Actions / Unit tests & SQLite integration tests (8.3)

Method Ibexa\Bundle\Core\Messenger\MessageProvider::getHandledClasses() return type has no value type specified in iterable type iterable.
{
return [PublishContentAsync::class];
}
}
8 changes: 8 additions & 0 deletions src/bundle/Core/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -372,3 +372,11 @@ services:
arguments:
$inner: '@.inner'

Ibexa\Bundle\Core\Message\PublishContentAsyncHandler:
autowire: true
tags:
- { name: messenger.message_handler, bus: ibexa.messenger.bus }

Ibexa\Bundle\Core\Messenger\MessageProvider:
tags:
- ibexa.messenger.sender_message_provider
Loading