Skip to content

Commit d5f4ff0

Browse files
committed
HM-1: Remove useless constructor
1 parent dc271be commit d5f4ff0

File tree

1 file changed

+8
-38
lines changed

1 file changed

+8
-38
lines changed

src/Controller/Action/AddSelectedProductsToCartAction.php

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,16 @@
1313

1414
namespace Sylius\WishlistPlugin\Controller\Action;
1515

16-
use Sylius\Component\Order\Context\CartContextInterface;
1716
use Sylius\WishlistPlugin\Command\Wishlist\AddSelectedProductsToCart;
1817
use Sylius\WishlistPlugin\Exception\InsufficientProductStockException;
1918
use Sylius\WishlistPlugin\Exception\InvalidProductQuantityException;
20-
use Sylius\WishlistPlugin\Processor\WishlistCommandProcessorInterface;
21-
use Sylius\WishlistPlugin\Repository\WishlistRepositoryInterface;
22-
use Symfony\Component\Form\FormFactoryInterface;
2319
use Symfony\Component\Form\FormInterface;
24-
use Symfony\Component\HttpFoundation\RequestStack;
2520
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
2621
use Symfony\Component\HttpFoundation\Session\Session;
2722
use Symfony\Component\Messenger\Exception\HandlerFailedException;
28-
use Symfony\Component\Messenger\MessageBusInterface;
29-
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
30-
use Symfony\Contracts\Translation\TranslatorInterface;
3123

3224
final class AddSelectedProductsToCartAction extends BaseWishlistProductsAction
3325
{
34-
public function __construct(
35-
CartContextInterface $cartContext,
36-
FormFactoryInterface $formFactory,
37-
RequestStack $requestStack,
38-
WishlistCommandProcessorInterface $wishlistCommandProcessor,
39-
MessageBusInterface $messageBus,
40-
UrlGeneratorInterface $urlGenerator,
41-
WishlistRepositoryInterface $wishlistRepository,
42-
TranslatorInterface $translator,
43-
) {
44-
parent::__construct(
45-
$cartContext,
46-
$formFactory,
47-
$requestStack,
48-
$wishlistCommandProcessor,
49-
$messageBus,
50-
$urlGenerator,
51-
$wishlistRepository,
52-
$translator,
53-
);
54-
}
55-
5626
protected function handleCommand(FormInterface $form): void
5727
{
5828
try {
@@ -66,6 +36,14 @@ protected function handleCommand(FormInterface $form): void
6636
}
6737
}
6838

39+
protected function getFlashBag(): FlashBagInterface
40+
{
41+
/** @var Session $session */
42+
$session = $this->requestStack->getSession();
43+
44+
return $session->getFlashBag();
45+
}
46+
6947
private function getExceptionMessage(HandlerFailedException $exception): string
7048
{
7149
$previous = $exception->getPrevious();
@@ -78,12 +56,4 @@ private function getExceptionMessage(HandlerFailedException $exception): string
7856

7957
return $exception->getMessage();
8058
}
81-
82-
protected function getFlashBag(): FlashBagInterface
83-
{
84-
/** @var Session $session */
85-
$session = $this->requestStack->getSession();
86-
87-
return $session->getFlashBag();
88-
}
8959
}

0 commit comments

Comments
 (0)