Skip to content

Commit 87d4090

Browse files
authored
Merge pull request #101 from BitBagCommerce/SHOP-44/Update_inpost_plugin_to_shopware_6_5
Update plugin to shopware 6.5
2 parents a0dfb10 + 260c2d8 commit 87d4090

15 files changed

Lines changed: 113 additions & 29 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
php: [ "7.4" ]
24+
php: [ "8.1" ]
2525

2626
steps:
2727
-

composer.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
}
1111
],
1212
"require": {
13-
"shopware/core": "6.4.*",
14-
"shopware/storefront": "6.4.*"
13+
"shopware/core": "6.5.*",
14+
"shopware/storefront": "6.5.*"
1515
},
1616
"require-dev": {
17-
"psalm/plugin-symfony": "^3.1",
17+
"psalm/plugin-symfony": "^4.0.4",
1818
"bitbag/coding-standard": "^1.0",
1919
"phpunit/phpunit": "^9.5"
2020
},
@@ -44,7 +44,8 @@
4444
"config": {
4545
"allow-plugins": {
4646
"dealerdirect/phpcodesniffer-composer-installer": true,
47-
"phpstan/extension-installer": true
47+
"phpstan/extension-installer": true,
48+
"symfony/runtime": true
4849
}
4950
}
5051
}

src/Calculator/OrderWeightCalculator.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@ public function calculate(OrderEntity $order, Context $context): float
4141
$products = array_map(fn (OrderLineItemEntity $item) => $item->getProduct(), $orderLineItems);
4242
$products = array_filter($products);
4343
$parentIds = array_filter($products, fn (ProductEntity $product) => null !== $product->getParentId());
44-
$parentProducts = $this->productRepository->search(
45-
new Criteria(array_column($parentIds, 'parentId')),
46-
$context
47-
);
48-
$parentProducts = $parentProducts->getElements();
44+
45+
if ($parentIds) {
46+
$parentProducts = $this->productRepository->search(
47+
new Criteria(array_column($parentIds, 'parentId')),
48+
$context
49+
);
50+
$parentProducts = $parentProducts->getElements();
51+
}
4952

5053
foreach ($orderLineItems as $item) {
5154
$product = $item->getProduct();

src/Controller/Api/InPostApiController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Symfony\Component\Routing\Annotation\Route;
2020

2121
/**
22-
* @RouteScope(scopes={"api"})
22+
* @Route(defaults={"_routeScope"={"api"}})
2323
*/
2424
final class InPostApiController
2525
{

src/Controller/Api/LabelController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
use Symfony\Component\Routing\Annotation\Route;
2525

2626
/**
27-
* @RouteScope(scopes={"api"})
27+
* @Route(defaults={"_routeScope"={"api"}})
2828
*/
2929
final class LabelController
3030
{

src/Controller/Api/OrderCourierController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
use Symfony\Component\Routing\Annotation\Route;
2929

3030
/**
31-
* @RouteScope(scopes={"api"})
31+
* @Route(defaults={"_routeScope"={"api"}})
3232
*/
3333
final class OrderCourierController
3434
{

src/Controller/Api/PackageController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
use Symfony\Component\Routing\Annotation\Route;
2525

2626
/**
27-
* @RouteScope(scopes={"api"})
27+
* @Route(defaults={"_routeScope"={"api"}})
2828
*/
2929
final class PackageController
3030
{

src/Core/Checkout/Cart/Validator/CartValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function validate(
5353
return;
5454
}
5555

56-
$postCode = $address->getZipcode();
56+
$postCode = $address->getZipcode() ?? '';
5757

5858
$this->checkPostCodeValidity($postCode, $address->getId(), $errors);
5959

src/Finder/CashOnDeliveryPaymentMethodFinder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212

1313
use Shopware\Core\Checkout\Payment\Cart\PaymentHandler\CashPayment;
1414
use Shopware\Core\Framework\Context;
15-
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
15+
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepository;
1616
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
1717
use Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter;
1818
use Shopware\Core\Framework\DataAbstractionLayer\Search\IdSearchResult;
1919

2020
final class CashOnDeliveryPaymentMethodFinder implements CashOnDeliveryPaymentMethodFinderInterface
2121
{
22-
private EntityRepositoryInterface $paymentMethodRepository;
22+
private EntityRepository $paymentMethodRepository;
2323

24-
public function __construct(EntityRepositoryInterface $paymentMethodRepository)
24+
public function __construct(EntityRepository $paymentMethodRepository)
2525
{
2626
$this->paymentMethodRepository = $paymentMethodRepository;
2727
}

src/Finder/OrderFinder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ public function getWithAssociations(string $orderId, Context $context): OrderEnt
4444

4545
$order = $this->orderRepository->search($orderCriteria, $context)->first();
4646

47-
if (null === $order) {
48-
throw new OrderNotFoundException('order.notFound');
47+
if ($order instanceof OrderEntity) {
48+
return $order;
4949
}
5050

51-
return $order;
51+
throw new OrderNotFoundException('order.notFound');
5252
}
5353

5454
public function getWithAssociationsByOrdersIds(array $ordersIds, Context $context): EntitySearchResult

0 commit comments

Comments
 (0)