diff --git a/doc/01-installation.md b/doc/01-installation.md index 664bc76e..382c5204 100644 --- a/doc/01-installation.md +++ b/doc/01-installation.md @@ -93,3 +93,21 @@ We recommend you to use Webpack (Encore), for which we have prepared four differ However, if you are not using Webpack, here are instructions on how to add optimized and compressed assets directly to your project templates: - [Non webpack solution](./01.5-non-webpack.md) + +## Asynchronous Messenger case + +In case you use asynchronous Messenger transport by default, there is a need to configure all Wishlist commands to sync transport. +You can do this by configuring the `WishlistSyncCommandInterface` interface to sync transport (as presented on code listing below). + +```yaml +# config/packages/messenger.yaml + +framework: + messenger: + transports: + sync: 'sync://' + routing: + 'BitBag\SyliusWishlistPlugin\Command\Wishlist\WishlistSyncCommandInterface': sync +``` + +All commands from the plugin implement the `WishlistSyncCommandInterface` interface, so there is no need for other configuration. diff --git a/src/Command/Wishlist/AddProductToSelectedWishlist.php b/src/Command/Wishlist/AddProductToSelectedWishlist.php index 5b6b22da..609b7bc0 100644 --- a/src/Command/Wishlist/AddProductToSelectedWishlist.php +++ b/src/Command/Wishlist/AddProductToSelectedWishlist.php @@ -13,7 +13,7 @@ use BitBag\SyliusWishlistPlugin\Entity\WishlistInterface; use Sylius\Component\Core\Model\ProductInterface; -final class AddProductToSelectedWishlist +final class AddProductToSelectedWishlist implements WishlistSyncCommandInterface { private WishlistInterface $wishlist; diff --git a/src/Command/Wishlist/AddProductsToCartInterface.php b/src/Command/Wishlist/AddProductsToCartInterface.php index aaaff234..089e776d 100644 --- a/src/Command/Wishlist/AddProductsToCartInterface.php +++ b/src/Command/Wishlist/AddProductsToCartInterface.php @@ -11,7 +11,7 @@ use Doctrine\Common\Collections\Collection; -interface AddProductsToCartInterface +interface AddProductsToCartInterface extends WishlistSyncCommandInterface { public function getWishlistProducts(): Collection; } diff --git a/src/Command/Wishlist/AddSelectedProductsToCart.php b/src/Command/Wishlist/AddSelectedProductsToCart.php index 90b3463d..46c91be1 100644 --- a/src/Command/Wishlist/AddSelectedProductsToCart.php +++ b/src/Command/Wishlist/AddSelectedProductsToCart.php @@ -12,7 +12,7 @@ use Doctrine\Common\Collections\Collection; -final class AddSelectedProductsToCart +final class AddSelectedProductsToCart implements WishlistSyncCommandInterface { /** @var Collection */ private Collection $wishlistProducts; diff --git a/src/Command/Wishlist/AddWishlistToUser.php b/src/Command/Wishlist/AddWishlistToUser.php index 4a57d36e..2b88274e 100644 --- a/src/Command/Wishlist/AddWishlistToUser.php +++ b/src/Command/Wishlist/AddWishlistToUser.php @@ -13,7 +13,7 @@ use BitBag\SyliusWishlistPlugin\Entity\WishlistInterface; use Sylius\Component\Core\Model\ShopUserInterface; -final class AddWishlistToUser +final class AddWishlistToUser implements WishlistSyncCommandInterface { private WishlistInterface $wishlist; diff --git a/src/Command/Wishlist/CopySelectedProductsToOtherWishlistInterface.php b/src/Command/Wishlist/CopySelectedProductsToOtherWishlistInterface.php index 9f8eecd9..9aa0f5e4 100644 --- a/src/Command/Wishlist/CopySelectedProductsToOtherWishlistInterface.php +++ b/src/Command/Wishlist/CopySelectedProductsToOtherWishlistInterface.php @@ -13,7 +13,7 @@ use Doctrine\Common\Collections\Collection; -interface CopySelectedProductsToOtherWishlistInterface +interface CopySelectedProductsToOtherWishlistInterface extends WishlistSyncCommandInterface { public function getWishlistProducts(): Collection; diff --git a/src/Command/Wishlist/CreateNewWishlist.php b/src/Command/Wishlist/CreateNewWishlist.php index 4fe0f6ee..2e7bcf39 100644 --- a/src/Command/Wishlist/CreateNewWishlist.php +++ b/src/Command/Wishlist/CreateNewWishlist.php @@ -10,7 +10,7 @@ namespace BitBag\SyliusWishlistPlugin\Command\Wishlist; -final class CreateNewWishlist +final class CreateNewWishlist implements WishlistSyncCommandInterface { public string $name = 'Wishlist'; diff --git a/src/Command/Wishlist/CreateWishlist.php b/src/Command/Wishlist/CreateWishlist.php index 3859c381..7e000a10 100644 --- a/src/Command/Wishlist/CreateWishlist.php +++ b/src/Command/Wishlist/CreateWishlist.php @@ -10,7 +10,7 @@ namespace BitBag\SyliusWishlistPlugin\Command\Wishlist; -final class CreateWishlist +final class CreateWishlist implements WishlistSyncCommandInterface { public ?string $tokenValue; diff --git a/src/Command/Wishlist/ExportSelectedProductsFromWishlistToPdfInterface.php b/src/Command/Wishlist/ExportSelectedProductsFromWishlistToPdfInterface.php index bac97379..838dd6dc 100644 --- a/src/Command/Wishlist/ExportSelectedProductsFromWishlistToPdfInterface.php +++ b/src/Command/Wishlist/ExportSelectedProductsFromWishlistToPdfInterface.php @@ -6,7 +6,7 @@ use Doctrine\Common\Collections\Collection; -interface ExportSelectedProductsFromWishlistToPdfInterface +interface ExportSelectedProductsFromWishlistToPdfInterface extends WishlistSyncCommandInterface { public function getWishlistProducts(): ?Collection; } diff --git a/src/Command/Wishlist/ExportWishlistToCsv.php b/src/Command/Wishlist/ExportWishlistToCsv.php index 2b53c7b8..2c538ea6 100644 --- a/src/Command/Wishlist/ExportWishlistToCsv.php +++ b/src/Command/Wishlist/ExportWishlistToCsv.php @@ -12,7 +12,7 @@ use Doctrine\Common\Collections\Collection; -final class ExportWishlistToCsv +final class ExportWishlistToCsv implements WishlistSyncCommandInterface { private Collection $wishlistProducts; diff --git a/src/Command/Wishlist/ImportWishlistFromCsv.php b/src/Command/Wishlist/ImportWishlistFromCsv.php index 7c46c468..683b2525 100644 --- a/src/Command/Wishlist/ImportWishlistFromCsv.php +++ b/src/Command/Wishlist/ImportWishlistFromCsv.php @@ -12,7 +12,7 @@ use Symfony\Component\HttpFoundation\Request; -final class ImportWishlistFromCsv +final class ImportWishlistFromCsv implements WishlistSyncCommandInterface { private \SplFileInfo $file; diff --git a/src/Command/Wishlist/RemoveProductFromWishlist.php b/src/Command/Wishlist/RemoveProductFromWishlist.php index ed8760ab..77a4c079 100644 --- a/src/Command/Wishlist/RemoveProductFromWishlist.php +++ b/src/Command/Wishlist/RemoveProductFromWishlist.php @@ -10,7 +10,7 @@ namespace BitBag\SyliusWishlistPlugin\Command\Wishlist; -final class RemoveProductFromWishlist +final class RemoveProductFromWishlist implements WishlistSyncCommandInterface { private int $productId; diff --git a/src/Command/Wishlist/RemoveProductVariantFromWishlist.php b/src/Command/Wishlist/RemoveProductVariantFromWishlist.php index d0eb2198..9e0da0d8 100644 --- a/src/Command/Wishlist/RemoveProductVariantFromWishlist.php +++ b/src/Command/Wishlist/RemoveProductVariantFromWishlist.php @@ -10,7 +10,7 @@ namespace BitBag\SyliusWishlistPlugin\Command\Wishlist; -final class RemoveProductVariantFromWishlist +final class RemoveProductVariantFromWishlist implements WishlistSyncCommandInterface { private int $productVariantId; diff --git a/src/Command/Wishlist/RemoveSelectedProductsFromWishlist.php b/src/Command/Wishlist/RemoveSelectedProductsFromWishlist.php index 3042ec74..8a463e20 100644 --- a/src/Command/Wishlist/RemoveSelectedProductsFromWishlist.php +++ b/src/Command/Wishlist/RemoveSelectedProductsFromWishlist.php @@ -12,7 +12,7 @@ use Doctrine\Common\Collections\Collection; -final class RemoveSelectedProductsFromWishlist +final class RemoveSelectedProductsFromWishlist implements WishlistSyncCommandInterface { /** @var Collection */ private Collection $wishlistProducts; diff --git a/src/Command/Wishlist/RemoveWishlist.php b/src/Command/Wishlist/RemoveWishlist.php index e2bb69b7..5269b3c4 100644 --- a/src/Command/Wishlist/RemoveWishlist.php +++ b/src/Command/Wishlist/RemoveWishlist.php @@ -10,7 +10,7 @@ namespace BitBag\SyliusWishlistPlugin\Command\Wishlist; -final class RemoveWishlist +final class RemoveWishlist implements WishlistSyncCommandInterface { private string $wishlistToken; diff --git a/src/Command/Wishlist/UpdateWishlistNameInterface.php b/src/Command/Wishlist/UpdateWishlistNameInterface.php index cc7c985b..25115434 100644 --- a/src/Command/Wishlist/UpdateWishlistNameInterface.php +++ b/src/Command/Wishlist/UpdateWishlistNameInterface.php @@ -12,7 +12,7 @@ use BitBag\SyliusWishlistPlugin\Entity\WishlistInterface; -interface UpdateWishlistNameInterface +interface UpdateWishlistNameInterface extends WishlistSyncCommandInterface { public function getName(): string; diff --git a/src/Command/Wishlist/WishlistItemInterface.php b/src/Command/Wishlist/WishlistItemInterface.php index 9d625313..a3fc5e49 100644 --- a/src/Command/Wishlist/WishlistItemInterface.php +++ b/src/Command/Wishlist/WishlistItemInterface.php @@ -13,7 +13,7 @@ use BitBag\SyliusWishlistPlugin\Entity\WishlistProductInterface; use Sylius\Bundle\OrderBundle\Controller\AddToCartCommandInterface; -interface WishlistItemInterface +interface WishlistItemInterface extends WishlistSyncCommandInterface { public function getWishlistProduct(): ?WishlistProductInterface; diff --git a/src/Command/Wishlist/WishlistSyncCommandInterface.php b/src/Command/Wishlist/WishlistSyncCommandInterface.php new file mode 100644 index 00000000..3aad2d3b --- /dev/null +++ b/src/Command/Wishlist/WishlistSyncCommandInterface.php @@ -0,0 +1,8 @@ +