Skip to content

Commit

Permalink
[TASK] Use DetailPageLinkFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
rintisch committed Jun 20, 2024
1 parent 9ecc37d commit 2609a62
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Classes/EventListener/Create/CreateCartProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
* LICENSE file that was distributed with this source code.
*/

use Extcode\Cart\Domain\Model\Cart\DetailPageLinkFactoryInterface;
use Extcode\Cart\Domain\Model\Cart\Product;
use Extcode\CartProducts\Event\RetrieveProductsFromRequestEvent;

class CreateCartProduct
{
public function __construct(protected DetailPageLinkFactoryInterface $detailPageLinkFactory)

Check failure on line 20 in Classes/EventListener/Create/CreateCartProduct.php

View workflow job for this annotation

GitHub Actions / code-quality (8.3, ^12.4)

Parameter $detailPageLinkFactory of method Extcode\CartProducts\EventListener\Create\CreateCartProduct::__construct() has invalid type Extcode\Cart\Domain\Model\Cart\DetailPageLinkFactoryInterface.

Check failure on line 20 in Classes/EventListener/Create/CreateCartProduct.php

View workflow job for this annotation

GitHub Actions / code-quality (8.3, ^12.4)

Property Extcode\CartProducts\EventListener\Create\CreateCartProduct::$detailPageLinkFactory has unknown class Extcode\Cart\Domain\Model\Cart\DetailPageLinkFactoryInterface as its type.
{}
public function __invoke(RetrieveProductsFromRequestEvent $event): void
{
$request = $event->getRequest();
Expand Down Expand Up @@ -53,10 +56,16 @@ public function __invoke(RetrieveProductsFromRequestEvent $event): void
$cartProduct->setIsVirtualProduct(true);
}

$cartProduct->addDetailPageParameter('pageUid', $request->getArgument('detailPageUid'));
$cartProduct->addDetailPageParameter('extensionName', 'cartproducts');
$cartProduct->addDetailPageParameter('pluginName', 'products');
$cartProduct->addDetailPageParameter('controller', 'product');
if($request->getArgument('detailPageUid')){
$detailPageLink = $this->detailPageLinkFactory->getDetailPageLink(

Check failure on line 60 in Classes/EventListener/Create/CreateCartProduct.php

View workflow job for this annotation

GitHub Actions / code-quality (8.3, ^12.4)

Call to method getDetailPageLink() on an unknown class Extcode\Cart\Domain\Model\Cart\DetailPageLinkFactoryInterface.
(int)$request->getArgument('detailPageUid'),
'cartproducts',
'products',
'product'
);
$cartProduct->setDetailPageLink($detailPageLink);

Check failure on line 66 in Classes/EventListener/Create/CreateCartProduct.php

View workflow job for this annotation

GitHub Actions / code-quality (8.3, ^12.4)

Call to an undefined method Extcode\Cart\Domain\Model\Cart\Product::setDetailPageLink().
}


$event->setCartProduct($cartProduct);
}
Expand Down

0 comments on commit 2609a62

Please sign in to comment.