Skip to content

Commit

Permalink
Improve index & remove entity message handler
Browse files Browse the repository at this point in the history
  • Loading branch information
SebLours committed Feb 20, 2025
1 parent adecef0 commit 68079c6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Message/Handler/AbstractEntityHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(ManagerRegistry $managerRegistry, private readonly I
$this->managerRegistry = $managerRegistry;
}

public function __invoke(RemoveEntity|IndexEntity $message): void
protected function handle(RemoveEntity|IndexEntity $message): void
{
$entity = $this->getManager($message->class)->find($message->class, $message->id);
if (null === $entity) {
Expand Down
6 changes: 6 additions & 0 deletions src/Message/Handler/IndexEntityHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
namespace Setono\SyliusMeilisearchPlugin\Message\Handler;

use Setono\SyliusMeilisearchPlugin\Config\Index;
use Setono\SyliusMeilisearchPlugin\Message\Command\IndexEntity;
use Setono\SyliusMeilisearchPlugin\Model\IndexableInterface;

final class IndexEntityHandler extends AbstractEntityHandler
{
public function __invoke(IndexEntity $message): void

Check failure on line 13 in src/Message/Handler/IndexEntityHandler.php

View workflow job for this annotation

GitHub Actions / Backwards Compatibility Check

The parameter $message of Setono\SyliusMeilisearchPlugin\Message\Handler\AbstractEntityHandler#__invoke() changed from Setono\SyliusMeilisearchPlugin\Message\Command\RemoveEntity|Setono\SyliusMeilisearchPlugin\Message\Command\IndexEntity to a non-contravariant Setono\SyliusMeilisearchPlugin\Message\Command\IndexEntity
{
$this->handle($message);
}

protected function execute(IndexableInterface $entity, Index $index): void
{
$index->indexer()->indexEntity($entity);
Expand Down
6 changes: 6 additions & 0 deletions src/Message/Handler/RemoveEntityHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@
namespace Setono\SyliusMeilisearchPlugin\Message\Handler;

use Setono\SyliusMeilisearchPlugin\Config\Index;
use Setono\SyliusMeilisearchPlugin\Message\Command\RemoveEntity;
use Setono\SyliusMeilisearchPlugin\Model\IndexableInterface;

final class RemoveEntityHandler extends AbstractEntityHandler
{
public function __invoke(RemoveEntity $message): void

Check failure on line 13 in src/Message/Handler/RemoveEntityHandler.php

View workflow job for this annotation

GitHub Actions / Backwards Compatibility Check

The parameter $message of Setono\SyliusMeilisearchPlugin\Message\Handler\AbstractEntityHandler#__invoke() changed from Setono\SyliusMeilisearchPlugin\Message\Command\RemoveEntity|Setono\SyliusMeilisearchPlugin\Message\Command\IndexEntity to a non-contravariant Setono\SyliusMeilisearchPlugin\Message\Command\RemoveEntity
{
$this->handle($message);
}

protected function execute(IndexableInterface $entity, Index $index): void
{
$index->indexer()->removeEntity($entity);
Expand Down

0 comments on commit 68079c6

Please sign in to comment.