Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve issue of default async messenger transport configuration #229

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions doc/01-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion src/Command/Wishlist/AddProductToSelectedWishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Wishlist/AddProductsToCartInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use Doctrine\Common\Collections\Collection;

interface AddProductsToCartInterface
interface AddProductsToCartInterface extends WishlistSyncCommandInterface
{
public function getWishlistProducts(): Collection;
}
2 changes: 1 addition & 1 deletion src/Command/Wishlist/AddSelectedProductsToCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use Doctrine\Common\Collections\Collection;

final class AddSelectedProductsToCart
final class AddSelectedProductsToCart implements WishlistSyncCommandInterface
{
/** @var Collection<WishlistItem> */
private Collection $wishlistProducts;
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Wishlist/AddWishlistToUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Doctrine\Common\Collections\Collection;

interface CopySelectedProductsToOtherWishlistInterface
interface CopySelectedProductsToOtherWishlistInterface extends WishlistSyncCommandInterface
{
public function getWishlistProducts(): Collection;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Wishlist/CreateNewWishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace BitBag\SyliusWishlistPlugin\Command\Wishlist;

final class CreateNewWishlist
final class CreateNewWishlist implements WishlistSyncCommandInterface
{
public string $name = 'Wishlist';

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Wishlist/CreateWishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace BitBag\SyliusWishlistPlugin\Command\Wishlist;

final class CreateWishlist
final class CreateWishlist implements WishlistSyncCommandInterface
{
public ?string $tokenValue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Doctrine\Common\Collections\Collection;

interface ExportSelectedProductsFromWishlistToPdfInterface
interface ExportSelectedProductsFromWishlistToPdfInterface extends WishlistSyncCommandInterface
{
public function getWishlistProducts(): ?Collection;
}
2 changes: 1 addition & 1 deletion src/Command/Wishlist/ExportWishlistToCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use Doctrine\Common\Collections\Collection;

final class ExportWishlistToCsv
final class ExportWishlistToCsv implements WishlistSyncCommandInterface
{
private Collection $wishlistProducts;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Wishlist/ImportWishlistFromCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use Symfony\Component\HttpFoundation\Request;

final class ImportWishlistFromCsv
final class ImportWishlistFromCsv implements WishlistSyncCommandInterface
{
private \SplFileInfo $file;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Wishlist/RemoveProductFromWishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace BitBag\SyliusWishlistPlugin\Command\Wishlist;

final class RemoveProductFromWishlist
final class RemoveProductFromWishlist implements WishlistSyncCommandInterface
{
private int $productId;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Wishlist/RemoveProductVariantFromWishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace BitBag\SyliusWishlistPlugin\Command\Wishlist;

final class RemoveProductVariantFromWishlist
final class RemoveProductVariantFromWishlist implements WishlistSyncCommandInterface
{
private int $productVariantId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use Doctrine\Common\Collections\Collection;

final class RemoveSelectedProductsFromWishlist
final class RemoveSelectedProductsFromWishlist implements WishlistSyncCommandInterface
{
/** @var Collection<WishlistItem> */
private Collection $wishlistProducts;
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Wishlist/RemoveWishlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace BitBag\SyliusWishlistPlugin\Command\Wishlist;

final class RemoveWishlist
final class RemoveWishlist implements WishlistSyncCommandInterface
{
private string $wishlistToken;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Wishlist/UpdateWishlistNameInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use BitBag\SyliusWishlistPlugin\Entity\WishlistInterface;

interface UpdateWishlistNameInterface
interface UpdateWishlistNameInterface extends WishlistSyncCommandInterface
{
public function getName(): string;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Wishlist/WishlistItemInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 8 additions & 0 deletions src/Command/Wishlist/WishlistSyncCommandInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace BitBag\SyliusWishlistPlugin\Command\Wishlist;

interface WishlistSyncCommandInterface
{

}
2 changes: 1 addition & 1 deletion src/Command/Wishlist/WishlistTokenValueAwareInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use BitBag\SyliusWishlistPlugin\Entity\WishlistInterface;
use Sylius\Bundle\ApiBundle\Command\CommandAwareDataTransformerInterface;

interface WishlistTokenValueAwareInterface extends CommandAwareDataTransformerInterface
interface WishlistTokenValueAwareInterface extends CommandAwareDataTransformerInterface, WishlistSyncCommandInterface
{
public function getWishlist(): WishlistInterface;

Expand Down
Loading