Skip to content

Commit

Permalink
Create Command and query attributes and use its
Browse files Browse the repository at this point in the history
  • Loading branch information
M0rgan01 committed Jul 10, 2023
1 parent f15dfeb commit 525b8da
Show file tree
Hide file tree
Showing 470 changed files with 1,325 additions and 1,155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

use Address;
use PrestaShop\PrestaShop\Adapter\Address\AbstractAddressHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Address\Command\AddCustomerAddressCommand;
use PrestaShop\PrestaShop\Core\Domain\Address\CommandHandler\AddCustomerAddressHandlerInterface;
use PrestaShop\PrestaShop\Core\Domain\Address\Exception\AddressConstraintException;
Expand All @@ -36,6 +37,7 @@
use PrestaShop\PrestaShop\Core\Domain\Address\ValueObject\AddressId;
use PrestaShopException;

#[AsCommandHandler]
final class AddCustomerAddressHandler extends AbstractAddressHandler implements AddCustomerAddressHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

use Address;
use PrestaShop\PrestaShop\Adapter\Address\AbstractAddressHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Address\Command\AddManufacturerAddressCommand;
use PrestaShop\PrestaShop\Core\Domain\Address\CommandHandler\AddManufacturerAddressHandlerInterface;
use PrestaShop\PrestaShop\Core\Domain\Address\Exception\AddressException;
Expand All @@ -37,6 +38,7 @@
/**
* Adds manufacturer address using legacy object model
*/
#[AsCommandHandler]
final class AddManufacturerAddressHandler extends AbstractAddressHandler implements AddManufacturerAddressHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace PrestaShop\PrestaShop\Adapter\Address\CommandHandler;

use PrestaShop\PrestaShop\Adapter\Address\AbstractAddressHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Address\Command\BulkDeleteAddressCommand;
use PrestaShop\PrestaShop\Core\Domain\Address\CommandHandler\BulkDeleteAddressHandlerInterface;
use PrestaShop\PrestaShop\Core\Domain\Address\Exception\AddressException;
Expand All @@ -35,6 +36,7 @@
/**
* Handles command which deletes addresses in bulk action
*/
#[AsCommandHandler]
final class BulkDeleteAddressHandler extends AbstractAddressHandler implements BulkDeleteAddressHandlerInterface
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Adapter/Address/CommandHandler/DeleteAddressHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@
namespace PrestaShop\PrestaShop\Adapter\Address\CommandHandler;

use PrestaShop\PrestaShop\Adapter\Address\AbstractAddressHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Address\Command\DeleteAddressCommand;
use PrestaShop\PrestaShop\Core\Domain\Address\CommandHandler\DeleteAddressHandlerInterface;
use PrestaShop\PrestaShop\Core\Domain\Address\Exception\DeleteAddressException;

/**
* Handles command which deletes address
*/
#[AsCommandHandler]
final class DeleteAddressHandler extends AbstractAddressHandler implements DeleteAddressHandlerInterface
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Adapter/Address/CommandHandler/EditCartAddressHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

use Cart;
use PrestaShop\PrestaShop\Adapter\Validate;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Address\Command\EditCartAddressCommand;
use PrestaShop\PrestaShop\Core\Domain\Address\Command\EditCustomerAddressCommand;
use PrestaShop\PrestaShop\Core\Domain\Address\CommandHandler\EditCartAddressHandlerInterface;
Expand All @@ -46,6 +47,7 @@
* EditCartAddressHandler manages an address update, it then updates cart
* relation to the newly created address.
*/
#[AsCommandHandler]
class EditCartAddressHandler implements EditCartAddressHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Address;
use Country;
use PrestaShop\PrestaShop\Adapter\Address\AbstractAddressHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Address\Command\EditCustomerAddressCommand;
use PrestaShop\PrestaShop\Core\Domain\Address\CommandHandler\EditCustomerAddressHandlerInterface;
use PrestaShop\PrestaShop\Core\Domain\Address\Exception\AddressConstraintException;
Expand All @@ -43,6 +44,7 @@
/**
* Handles update of customer address
*/
#[AsCommandHandler]
final class EditCustomerAddressHandler extends AbstractAddressHandler implements EditCustomerAddressHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use Address;
use Country;
use PrestaShop\PrestaShop\Adapter\Address\AbstractAddressHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Address\Command\EditManufacturerAddressCommand;
use PrestaShop\PrestaShop\Core\Domain\Address\CommandHandler\EditManufacturerAddressHandlerInterface;
use PrestaShop\PrestaShop\Core\Domain\Address\Exception\AddressException;
Expand All @@ -37,6 +38,7 @@
/**
* Handles command which edits manufacturer address
*/
#[AsCommandHandler]
final class EditManufacturerAddressHandler extends AbstractAddressHandler implements EditManufacturerAddressHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
namespace PrestaShop\PrestaShop\Adapter\Address\CommandHandler;

use Order;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Address\Command\EditCustomerAddressCommand;
use PrestaShop\PrestaShop\Core\Domain\Address\Command\EditOrderAddressCommand;
use PrestaShop\PrestaShop\Core\Domain\Address\CommandHandler\EditCustomerAddressHandlerInterface;
Expand All @@ -48,6 +49,7 @@
* EditOrderAddressCommandHandler manages an address update, it then updates order and cart
* relation to the newly created address.
*/
#[AsCommandHandler]
class EditOrderAddressHandler implements EditOrderAddressHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace PrestaShop\PrestaShop\Adapter\Address\CommandHandler;

use CustomerAddress;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Address\Command\SetRequiredFieldsForAddressCommand;
use PrestaShop\PrestaShop\Core\Domain\Address\CommandHandler\SetRequiredFieldsForAddressHandlerInterface;
use PrestaShop\PrestaShop\Core\Domain\Address\Exception\CannotSetRequiredFieldsForAddressException;
Expand All @@ -37,6 +38,7 @@
*
* @internal
*/
#[AsCommandHandler]
final class SetRequiredFieldsForAddressHandler implements SetRequiredFieldsForAddressHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

use Customer;
use PrestaShop\PrestaShop\Adapter\Address\AbstractCustomerAddressHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsQueryHandler;
use PrestaShop\PrestaShop\Core\Domain\Address\Exception\AddressException;
use PrestaShop\PrestaShop\Core\Domain\Address\Exception\AddressNotFoundException;
use PrestaShop\PrestaShop\Core\Domain\Address\Query\GetCustomerAddressForEditing;
Expand All @@ -46,6 +47,7 @@
/**
* Handles query which gets customer address for editing
*/
#[AsQueryHandler]
final class GetCustomerAddressForEditingHandler extends AbstractCustomerAddressHandler implements GetCustomerAddressForEditingHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@
namespace PrestaShop\PrestaShop\Adapter\Address\QueryHandler;

use PrestaShop\PrestaShop\Adapter\Address\AbstractAddressHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsQueryHandler;
use PrestaShop\PrestaShop\Core\Domain\Address\Query\GetManufacturerAddressForEditing;
use PrestaShop\PrestaShop\Core\Domain\Address\QueryHandler\GetManufacturerAddressForEditingHandlerInterface;
use PrestaShop\PrestaShop\Core\Domain\Address\QueryResult\EditableManufacturerAddress;

/**
* Handles query which gets manufacturer address for editing
*/
#[AsQueryHandler]
final class GetManufacturerAddressForEditingHandler extends AbstractAddressHandler implements GetManufacturerAddressForEditingHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace PrestaShop\PrestaShop\Adapter\Address\QueryHandler;

use PrestaShop\PrestaShop\Adapter\Address\AbstractCustomerAddressHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsQueryHandler;
use PrestaShop\PrestaShop\Core\Domain\Address\Exception\AddressException;
use PrestaShop\PrestaShop\Core\Domain\Address\Query\GetRequiredFieldsForAddress;
use PrestaShop\PrestaShop\Core\Domain\Address\QueryHandler\GetRequiredFieldsForAddressHandlerInterface;
Expand All @@ -36,6 +37,7 @@
*
* @internal
*/
#[AsQueryHandler]
final class GetRequiredFieldsForAddressHandler extends AbstractCustomerAddressHandler implements GetRequiredFieldsForAddressHandlerInterface
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Adapter/Alias/CommandHandler/AddAliasHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
namespace PrestaShop\PrestaShop\Adapter\Alias\CommandHandler;

use PrestaShop\PrestaShop\Adapter\Alias\Repository\AliasRepository;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Alias\Command\AddAliasCommand;
use PrestaShop\PrestaShop\Core\Domain\Alias\CommandHandler\AddAliasHandlerInterface;

#[AsCommandHandler]
class AddAliasHandler implements AddAliasHandlerInterface
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Adapter/Alias/CommandHandler/BulkDeleteAliasHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
namespace PrestaShop\PrestaShop\Adapter\Alias\CommandHandler;

use PrestaShop\PrestaShop\Adapter\Alias\Repository\AliasRepository;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\AbstractBulkCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Alias\Command\BulkDeleteAliasCommand;
use PrestaShop\PrestaShop\Core\Domain\Alias\CommandHandler\BulkDeleteAliasHandlerInterface;
Expand All @@ -40,6 +41,7 @@
/**
* Handles command which deletes aliases in bulk action
*/
#[AsCommandHandler]
class BulkDeleteAliasHandler extends AbstractBulkCommandHandler implements BulkDeleteAliasHandlerInterface
{
public function __construct(protected AliasRepository $aliasRepository)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
namespace PrestaShop\PrestaShop\Adapter\Alias\CommandHandler;

use PrestaShop\PrestaShop\Adapter\Alias\Repository\AliasRepository;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\AbstractBulkCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Alias\Command\BulkUpdateAliasStatusCommand;
use PrestaShop\PrestaShop\Core\Domain\Alias\CommandHandler\BulkUpdateAliasStatusHandlerInterface;
Expand All @@ -39,6 +40,7 @@
use PrestaShop\PrestaShop\Core\Domain\Exception\BulkCommandExceptionInterface;
use PrestaShop\PrestaShop\Core\Domain\Feature\Exception\BulkFeatureException;

#[AsCommandHandler]
class BulkUpdateAliasStatusHandler extends AbstractBulkCommandHandler implements BulkUpdateAliasStatusHandlerInterface
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Adapter/Alias/CommandHandler/DeleteAliasHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
namespace PrestaShop\PrestaShop\Adapter\Alias\CommandHandler;

use PrestaShop\PrestaShop\Adapter\Alias\Repository\AliasRepository;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Alias\Command\DeleteAliasCommand;
use PrestaShop\PrestaShop\Core\Domain\Alias\CommandHandler\DeleteAliasHandlerInterface;

#[AsCommandHandler]
class DeleteAliasHandler implements DeleteAliasHandlerInterface
{
public function __construct(private readonly AliasRepository $aliasRepository)
Expand Down
2 changes: 2 additions & 0 deletions src/Adapter/Alias/CommandHandler/UpdateAliasHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
namespace PrestaShop\PrestaShop\Adapter\Alias\CommandHandler;

use PrestaShop\PrestaShop\Adapter\Alias\Repository\AliasRepository;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Alias\Command\UpdateAliasCommand;
use PrestaShop\PrestaShop\Core\Domain\Alias\CommandHandler\UpdateAliasHandlerInterface;

#[AsCommandHandler]
class UpdateAliasHandler implements UpdateAliasHandlerInterface
{
public function __construct(
Expand Down
2 changes: 2 additions & 0 deletions src/Adapter/Alias/CommandHandler/UpdateAliasStatusHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@
namespace PrestaShop\PrestaShop\Adapter\Alias\CommandHandler;

use PrestaShop\PrestaShop\Adapter\Alias\Repository\AliasRepository;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Alias\Command\UpdateAliasStatusCommand;
use PrestaShop\PrestaShop\Core\Domain\Alias\CommandHandler\UpdateAliasStatusHandlerInterfaces;
use PrestaShop\PrestaShop\Core\Domain\Alias\Exception\CannotUpdateAliasException;

/**
* Toggles alias status
*/
#[AsCommandHandler]
class UpdateAliasStatusHandler implements UpdateAliasStatusHandlerInterfaces
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Adapter/Alias/QueryHandler/GetAliasForEditingHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@
namespace PrestaShop\PrestaShop\Adapter\Alias\QueryHandler;

use PrestaShop\PrestaShop\Adapter\Alias\Repository\AliasRepository;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsQueryHandler;
use PrestaShop\PrestaShop\Core\Domain\Alias\Query\GetAliasForEditing;
use PrestaShop\PrestaShop\Core\Domain\Alias\QueryHandler\GetAliasForEditingHandlerInterface;
use PrestaShop\PrestaShop\Core\Domain\Alias\QueryResult\AliasForEditing;

/**
* Handles the query @see GetAliasForEditing using legacy ObjectModel
*/
#[AsQueryHandler]
class GetAliasForEditingHandler implements GetAliasForEditingHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

use Attachment;
use PrestaShop\PrestaShop\Adapter\Attachment\AbstractAttachmentHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Attachment\AttachmentFileUploaderInterface;
use PrestaShop\PrestaShop\Core\Domain\Attachment\Command\AddAttachmentCommand;
use PrestaShop\PrestaShop\Core\Domain\Attachment\CommandHandler\AddAttachmentHandlerInterface;
Expand All @@ -43,6 +44,7 @@
/**
* Handles attachment creation and file uploading procedures
*/
#[AsCommandHandler]
final class AddAttachmentHandler extends AbstractAttachmentHandler implements AddAttachmentHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace PrestaShop\PrestaShop\Adapter\Attachment\CommandHandler;

use PrestaShop\PrestaShop\Adapter\Attachment\AbstractAttachmentHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Attachment\Command\BulkDeleteAttachmentsCommand;
use PrestaShop\PrestaShop\Core\Domain\Attachment\CommandHandler\BulkDeleteAttachmentsHandlerInterface;
use PrestaShop\PrestaShop\Core\Domain\Attachment\Exception\AttachmentException;
Expand All @@ -35,6 +36,7 @@
/**
* Bulk delete attachments handler
*/
#[AsCommandHandler]
final class BulkDeleteAttachmentsHandler extends AbstractAttachmentHandler implements BulkDeleteAttachmentsHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace PrestaShop\PrestaShop\Adapter\Attachment\CommandHandler;

use PrestaShop\PrestaShop\Adapter\Attachment\AbstractAttachmentHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Attachment\Command\DeleteAttachmentCommand;
use PrestaShop\PrestaShop\Core\Domain\Attachment\CommandHandler\DeleteAttachmentHandlerInterface;
use PrestaShop\PrestaShop\Core\Domain\Attachment\Exception\AttachmentNotFoundException;
Expand All @@ -35,6 +36,7 @@
/**
* Delete attachment handler
*/
#[AsCommandHandler]
final class DeleteAttachmentHandler extends AbstractAttachmentHandler implements DeleteAttachmentHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

use Attachment;
use PrestaShop\PrestaShop\Adapter\Attachment\AbstractAttachmentHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsCommandHandler;
use PrestaShop\PrestaShop\Core\Domain\Attachment\AttachmentFileUploaderInterface;
use PrestaShop\PrestaShop\Core\Domain\Attachment\Command\EditAttachmentCommand;
use PrestaShop\PrestaShop\Core\Domain\Attachment\CommandHandler\EditAttachmentHandlerInterface;
Expand All @@ -41,6 +42,7 @@
/**
* Handles editing of attachment and file uploading procedures
*/
#[AsCommandHandler]
final class EditAttachmentHandler extends AbstractAttachmentHandler implements EditAttachmentHandlerInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace PrestaShop\PrestaShop\Adapter\Attachment\QueryHandler;

use Attachment;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsQueryHandler;
use PrestaShop\PrestaShop\Core\Domain\Attachment\Exception\AttachmentNotFoundException;
use PrestaShop\PrestaShop\Core\Domain\Attachment\Query\GetAttachmentForEditing;
use PrestaShop\PrestaShop\Core\Domain\Attachment\QueryHandler\GetAttachmentForEditingHandlerInterface;
Expand All @@ -39,6 +40,7 @@
*
* @internal
*/
#[AsQueryHandler]
final class GetAttachmentForEditingHandler implements GetAttachmentForEditingHandlerInterface
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Adapter/Attachment/QueryHandler/GetAttachmentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace PrestaShop\PrestaShop\Adapter\Attachment\QueryHandler;

use PrestaShop\PrestaShop\Adapter\Attachment\AbstractAttachmentHandler;
use PrestaShop\PrestaShop\Core\CommandBus\Attributes\AsQueryHandler;
use PrestaShop\PrestaShop\Core\Domain\Attachment\Exception\AttachmentNotFoundException;
use PrestaShop\PrestaShop\Core\Domain\Attachment\Query\GetAttachment;
use PrestaShop\PrestaShop\Core\Domain\Attachment\QueryHandler\GetAttachmentHandlerInterface;
Expand All @@ -35,6 +36,7 @@
/**
* Provides path and original file name of attachment
*/
#[AsQueryHandler]
final class GetAttachmentHandler extends AbstractAttachmentHandler implements GetAttachmentHandlerInterface
{
/**
Expand Down

0 comments on commit 525b8da

Please sign in to comment.