Skip to content

Commit

Permalink
chore: code style
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpoensgen committed May 10, 2024
1 parent 1f2f6ad commit ccf737e
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
12 changes: 6 additions & 6 deletions src/Administration/Controller/ShareBasketController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,32 @@ public function statistics(Request $request, Context $context): Response
'SUM(1 * save_count) as saveCount',
'SUM(froshShareBasketLineItem.quantity * save_count) as totalQuantity',
'IFNULL(translation.name, translationDefault.name) as productName',
]
],
)
->from('frosh_share_basket', 'shareBasket')
->innerJoin(
'shareBasket',
'frosh_share_basket_line_item',
'froshShareBasketLineItem',
'shareBasket.id = froshShareBasketLineItem.share_basket_id'
'shareBasket.id = froshShareBasketLineItem.share_basket_id',
)
->leftJoin(
'froshShareBasketLineItem',
'product',
'product',
'froshShareBasketLineItem.identifier = product.product_number'
'froshShareBasketLineItem.identifier = product.product_number',
)
->leftJoin(
'product',
'product_translation',
'translation',
'product.id = translation.product_id AND translation.language_id = :language'
'product.id = translation.product_id AND translation.language_id = :language',
)
->leftJoin(
'product',
'product_translation',
'translationDefault',
'product.id = translationDefault.product_id AND translationDefault.language_id = :defaultLanguage'
'product.id = translationDefault.product_id AND translationDefault.language_id = :defaultLanguage',
)
->where('froshShareBasketLineItem.type = :type')
->groupBy('froshShareBasketLineItem.identifier')
Expand All @@ -73,7 +73,7 @@ public function statistics(Request $request, Context $context): Response
foreach ($request->get('sortings') as $condition) {
$query->addOrderBy(
$condition['field'],
$condition['order']
$condition['order'],
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Core/Content/Product/ProductShareBasketExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function extendFields(FieldCollection $collection): void
'product_number',
'identifier',
ShareBasketLineItemDefinition::class,
false
false,
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ShareBasketAddLineItemEvent extends Event
public function __construct(
private readonly Cart $cart,
private readonly SalesChannelContext $salesChannelContext,
private readonly ShareBasketLineItemEntity $shareBasketLineItemEntity
private readonly ShareBasketLineItemEntity $shareBasketLineItemEntity,
) {}

public function getCart(): Cart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ShareBasketPrepareLineItemEvent extends Event
public function __construct(
private array $shareBasketLineItem,
private readonly LineItem $lineItem,
private readonly SalesChannelContext $salesChannelContext
private readonly SalesChannelContext $salesChannelContext,
) {}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function extendFields(FieldCollection $collection): void
(new OneToManyAssociationField(
'shareBaskets',
ShareBasketDefinition::class,
'sales_channel_id'
'sales_channel_id',
))->addFlags(new CascadeDelete()),
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ScheduledTask/ShareBasketCleanupTaskHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ShareBasketCleanupTaskHandler extends ScheduledTaskHandler
*/
public function __construct(
EntityRepository $scheduledTaskRepository,
private readonly ShareBasketServiceInterface $shareBasketService
private readonly ShareBasketServiceInterface $shareBasketService,
) {
parent::__construct($scheduledTaskRepository);
}
Expand Down
18 changes: 9 additions & 9 deletions src/Services/ShareBasketService.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(
#[Autowire(service: 'sales_channel.product.repository')]
private SalesChannelRepository $productRepository,
private SystemConfigService $systemConfigService,
private EventDispatcherInterface $eventDispatcher
private EventDispatcherInterface $eventDispatcher,
) {}

/**
Expand Down Expand Up @@ -177,14 +177,14 @@ public function cleanup(): ?EntityWrittenContainerEvent
'createdAt',
[
RangeFilter::LTE => $dateTime->format(Defaults::STORAGE_DATE_TIME_FORMAT),
]
],
));

$criteria->addAssociation('lineItems');

$this->eventDispatcher->dispatch(
new ShareBasketCleanupCriteriaEvent($criteria),
ShareBasketCleanupCriteriaEvent::class
ShareBasketCleanupCriteriaEvent::class,
);

$shareBasketEntities = $this->froshShareBasketRepository->searchIds($criteria, Context::createDefaultContext());
Expand All @@ -201,7 +201,7 @@ public function cleanup(): ?EntityWrittenContainerEvent
private function addLineItems(
Cart $cart,
SalesChannelContext $salesChannelContext,
ShareBasketEntity $shareBasketEntity
ShareBasketEntity $shareBasketEntity,
): void {
foreach ($shareBasketEntity->getLineItems() as $shareBasketLineItemEntity) {
try {
Expand Down Expand Up @@ -256,7 +256,7 @@ private function generateBasketUrl(string $basketId): string
return $this->router->generate(
'frontend.frosh.share-basket.load',
['basketId' => $basketId],
UrlGeneratorInterface::ABSOLUTE_URL
UrlGeneratorInterface::ABSOLUTE_URL,
);
}

Expand All @@ -277,7 +277,7 @@ private function generateShareBasketId(): string
private function addProduct(
Cart $cart,
SalesChannelContext $salesChannelContext,
ShareBasketLineItemEntity $shareBasketLineItemEntity
ShareBasketLineItemEntity $shareBasketLineItemEntity,
): void {
$productId = $this->getProductIdByNumber($shareBasketLineItemEntity->getIdentifier(), $salesChannelContext);

Expand All @@ -289,7 +289,7 @@ private function addProduct(
$shareBasketLineItemEntity->getLineItemIdentifier(),
$shareBasketLineItemEntity->getType(),
$productId,
$shareBasketLineItemEntity->getQuantity()
$shareBasketLineItemEntity->getQuantity(),
);
$this->setPayloadValues($shareBasketLineItemEntity->getPayload() ?? [], $lineItem);
$lineItem->setStackable($shareBasketLineItemEntity->isStackable());
Expand All @@ -301,11 +301,11 @@ private function addProduct(
private function addPromotion(
Cart $cart,
SalesChannelContext $salesChannelContext,
ShareBasketLineItemEntity $shareBasketLineItemEntity
ShareBasketLineItemEntity $shareBasketLineItemEntity,
): void {
$itemBuilder = new PromotionItemBuilder();
$lineItem = $itemBuilder->buildPlaceholderItem(
$shareBasketLineItemEntity->getIdentifier()
$shareBasketLineItemEntity->getIdentifier(),
);
$this->cartService->add($cart, $lineItem, $salesChannelContext);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Storefront/Controller/ShareBasketController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function save(Request $request, SalesChannelContext $context): Response
[
'froshShareBasketState' => $froshShareBasketState,
'froshShareBasketUrl' => $froshShareBasketUrl,
]
],
);
}

Expand All @@ -51,7 +51,7 @@ public function load(Request $request, SalesChannelContext $context): Response

return $this->forwardToRoute(
'frontend.checkout.cart.page',
['froshShareBasketState' => $froshShareBasketState]
['froshShareBasketState' => $froshShareBasketState],
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function onCartLoaded(CheckoutCartPageLoadedEvent $event): void
'froshShareBasketUrl' => $this->shareBasketService->saveCart(
$event->getRequest(),
$shareBasketData,
$event->getSalesChannelContext()
$event->getSalesChannelContext(),
),
]);
}
Expand Down

0 comments on commit ccf737e

Please sign in to comment.