generated from Setono/SyliusPluginSkeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
315 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Setono\SyliusOrderEditPlugin\Checker; | ||
|
||
use Setono\SyliusOrderEditPlugin\Exception\NewOrderWrongTotalException; | ||
use Sylius\Component\Core\Model\OrderInterface; | ||
|
||
final class PostUpdateChangesChecker implements PostUpdateChangesCheckerInterface | ||
{ | ||
public function check(OrderInterface $previousOrder, OrderInterface $newOrder): void | ||
{ | ||
if ($newOrder->getTotal() > $previousOrder->getTotal()) { | ||
throw new NewOrderWrongTotalException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Setono\SyliusOrderEditPlugin\Checker; | ||
|
||
use Sylius\Component\Core\Model\OrderInterface; | ||
|
||
interface PostUpdateChangesCheckerInterface | ||
{ | ||
public function check(OrderInterface $previousOrder, OrderInterface $newOrder): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Setono\SyliusOrderEditPlugin\Exception; | ||
|
||
final class OrderUpdateException extends \RuntimeException | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct('Something went wrong when updating order.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Setono\SyliusOrderEditPlugin\Preparer; | ||
|
||
use Sylius\Component\Core\Model\OrderInterface; | ||
|
||
interface OrderPreparerInterface | ||
{ | ||
public function prepareToUpdate(int $orderId): OrderInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Setono\SyliusOrderEditPlugin\Processor; | ||
|
||
use Sylius\Component\Core\Model\OrderInterface; | ||
|
||
interface UpdatedOrderProcessorInterface | ||
{ | ||
public function process(OrderInterface $newOrder): OrderInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Setono\SyliusOrderEditPlugin\Provider; | ||
|
||
use Sylius\Component\Core\Model\OrderInterface; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
interface UpdatedOrderProviderInterface | ||
{ | ||
public function fromRequest(OrderInterface $order, Request $request): OrderInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
setono_sylius_order_edit: | ||
error: | ||
order_update: 'Order should not have bigger total than before editing' | ||
success: | ||
order_update: 'Order has been successfully updated' | ||
order_update: | ||
general_error: 'An error occurred while updating the order' | ||
total_error: 'Order should not have bigger total than before editing' | ||
success: 'Order has been successfully updated' |
2 changes: 2 additions & 0 deletions
2
tests/Application/config/routes/setono_sylius_order_edit.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
setono_sylius_edit_order: | ||
resource: "@SetonoSyliusOrderEditPlugin/Resources/config/routes.yaml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
sylius_admin: | ||
resource: "@SyliusAdminBundle/Resources/config/routing.yml" | ||
prefix: '/%sylius_admin.path_name%' | ||
|
||
setono_edit_order: | ||
resource: "@SetonoSyliusOrderEditPlugin/Resources/config/routes.yaml" |
Oops, something went wrong.