Skip to content

Commit

Permalink
[Workspace] fixes copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorfin committed Apr 30, 2024
1 parent eddaec5 commit 3deda7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/core/Messenger/CopyWorkspaceHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,23 @@
namespace Claroline\CoreBundle\Messenger;

use Claroline\AppBundle\API\Crud;
use Claroline\AppBundle\Persistence\ObjectManager;
use Claroline\CoreBundle\Entity\Workspace\Workspace;
use Claroline\CoreBundle\Messenger\Message\CopyWorkspace;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;

class CopyWorkspaceHandler implements MessageHandlerInterface
{
public function __construct(private readonly Crud $crud)
{
public function __construct(
private readonly ObjectManager $om,
private readonly Crud $crud
) {
}

public function __invoke(CopyWorkspace $copyWorkspace): void
{
$workspace = $this->crud->get(Workspace::class, $copyWorkspace->getWorkspaceId());
$workspace = $this->om->getRepository(Workspace::class)->find($copyWorkspace->getWorkspaceId());
if (empty($workspace)) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/main/core/Resources/config/services/messenger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:

Claroline\CoreBundle\Messenger\CopyWorkspaceHandler:
arguments:
- '@Claroline\AppBundle\Persistence\ObjectManager'
- '@Claroline\AppBundle\API\Crud'

Claroline\CoreBundle\Messenger\SendMessageHandler:
Expand Down

0 comments on commit 3deda7e

Please sign in to comment.