diff --git a/phpspec.yml.dist b/phpspec.yml.dist
index 142525c481..90426b995d 100644
--- a/phpspec.yml.dist
+++ b/phpspec.yml.dist
@@ -67,6 +67,7 @@ suites:
SequenceBundle: { namespace: Sylius\Bundle\SequenceBundle, psr4_prefix: Sylius\Bundle\SequenceBundle, spec_path: src/Sylius/Bundle/SequenceBundle, src_path: src/Sylius/Bundle/SequenceBundle }
SettingsBundle: { namespace: Sylius\Bundle\SettingsBundle, psr4_prefix: Sylius\Bundle\SettingsBundle, spec_path: src/Sylius/Bundle/SettingsBundle, src_path: src/Sylius/Bundle/SettingsBundle }
ShippingBundle: { namespace: Sylius\Bundle\ShippingBundle, psr4_prefix: Sylius\Bundle\ShippingBundle, spec_path: src/Sylius/Bundle/ShippingBundle, src_path: src/Sylius/Bundle/ShippingBundle }
+ ShopBundle: { namespace: Sylius\Bundle\ShopBundle, psr4_prefix: Sylius\Bundle\ShopBundle, spec_path: src/Sylius/Bundle/ShopBundle, src_path: src/Sylius/Bundle/ShopBundle }
TaxationBundle: { namespace: Sylius\Bundle\TaxationBundle, psr4_prefix: Sylius\Bundle\TaxationBundle, spec_path: src/Sylius/Bundle/TaxationBundle, src_path: src/Sylius/Bundle/TaxationBundle }
TaxonomyBundle: { namespace: Sylius\Bundle\TaxonomyBundle, psr4_prefix: Sylius\Bundle\TaxonomyBundle, spec_path: src/Sylius/Bundle/TaxonomyBundle, src_path: src/Sylius/Bundle/TaxonomyBundle }
ThemeBundle: { namespace: Sylius\Bundle\ThemeBundle, psr4_prefix: Sylius\Bundle\ThemeBundle , spec_path: src/Sylius/Bundle/ThemeBundle, src_path: src/Sylius/Bundle/ThemeBundle }
diff --git a/src/Sylius/Bundle/CoreBundle/Resources/config/services.xml b/src/Sylius/Bundle/CoreBundle/Resources/config/services.xml
index b58e53761c..3ad9fd1e05 100644
--- a/src/Sylius/Bundle/CoreBundle/Resources/config/services.xml
+++ b/src/Sylius/Bundle/CoreBundle/Resources/config/services.xml
@@ -75,7 +75,6 @@
Sylius\Bundle\CoreBundle\EventListener\CustomerReviewsDeleteListener
Sylius\Bundle\CoreBundle\EventListener\OrderRecalculationListener
Sylius\Bundle\CoreBundle\EventListener\UserCartRecalculationListener
- Sylius\Bundle\CoreBundle\EventListener\StoreOrderIdListener
Sylius\Component\Core\Provider\ActivePromotionsByChannelProvider
@@ -413,10 +412,6 @@
-
-
-
-
diff --git a/src/Sylius/Bundle/ShopBundle/DependencyInjection/SyliusShopExtension.php b/src/Sylius/Bundle/ShopBundle/DependencyInjection/SyliusShopExtension.php
index c1e0937411..33b780f425 100644
--- a/src/Sylius/Bundle/ShopBundle/DependencyInjection/SyliusShopExtension.php
+++ b/src/Sylius/Bundle/ShopBundle/DependencyInjection/SyliusShopExtension.php
@@ -29,6 +29,7 @@ class SyliusShopExtension extends Extension
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('controller.xml');
+ $loader->load('listeners.xml');
$loader->load('menu.xml');
}
}
diff --git a/src/Sylius/Bundle/CoreBundle/EventListener/StoreOrderIdListener.php b/src/Sylius/Bundle/ShopBundle/EventListener/CheckoutCompleteListener.php
similarity index 84%
rename from src/Sylius/Bundle/CoreBundle/EventListener/StoreOrderIdListener.php
rename to src/Sylius/Bundle/ShopBundle/EventListener/CheckoutCompleteListener.php
index e92d14eda5..fdfc2b235f 100644
--- a/src/Sylius/Bundle/CoreBundle/EventListener/StoreOrderIdListener.php
+++ b/src/Sylius/Bundle/ShopBundle/EventListener/CheckoutCompleteListener.php
@@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
-namespace Sylius\Bundle\CoreBundle\EventListener;
+namespace Sylius\Bundle\ShopBundle\EventListener;
use Sylius\Component\Core\Model\OrderInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
@@ -19,7 +19,7 @@ use Webmozart\Assert\Assert;
/**
* @author Arkadiusz Krakowiak
*/
-class StoreOrderIdListener
+class CheckoutCompleteListener
{
/**
* @var SessionInterface
@@ -35,14 +35,14 @@ class StoreOrderIdListener
}
/**
- * @param GenericEvent $event
+ * {@inheritdoc}
*/
- public function setOrderId(GenericEvent $event)
+ public function onCheckoutComplete(GenericEvent $event)
{
/** @var OrderInterface $order */
$order = $event->getSubject();
Assert::isInstanceOf($order, OrderInterface::class);
-
+
$this->session->set('sylius_order_id', $order->getId());
}
}
diff --git a/src/Sylius/Bundle/ShopBundle/Resources/config/listeners.xml b/src/Sylius/Bundle/ShopBundle/Resources/config/listeners.xml
new file mode 100644
index 0000000000..5b107dc2fd
--- /dev/null
+++ b/src/Sylius/Bundle/ShopBundle/Resources/config/listeners.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+ Sylius\Bundle\ShopBundle\EventListener\CheckoutCompleteListener
+
+
+
+
+
+
+
+
+
diff --git a/src/Sylius/Bundle/CoreBundle/spec/EventListener/StoreOrderIdListenerSpec.php b/src/Sylius/Bundle/ShopBundle/spec/EventListener/CheckoutCompleteListenerSpec.php
similarity index 77%
rename from src/Sylius/Bundle/CoreBundle/spec/EventListener/StoreOrderIdListenerSpec.php
rename to src/Sylius/Bundle/ShopBundle/spec/EventListener/CheckoutCompleteListenerSpec.php
index c5d8f15d22..7d27b06a67 100644
--- a/src/Sylius/Bundle/CoreBundle/spec/EventListener/StoreOrderIdListenerSpec.php
+++ b/src/Sylius/Bundle/ShopBundle/spec/EventListener/CheckoutCompleteListenerSpec.php
@@ -9,22 +9,22 @@
* file that was distributed with this source code.
*/
-namespace spec\Sylius\Bundle\CoreBundle\EventListener;
+namespace spec\Sylius\Bundle\ShopBundle\EventListener;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
-use Sylius\Bundle\CoreBundle\EventListener\StoreOrderIdListener;
+use Sylius\Bundle\ShopBundle\EventListener\CheckoutCompleteListener;
use Sylius\Component\Addressing\Model\CountryInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
/**
- * @mixin StoreOrderIdListener
+ * @mixin CheckoutCompleteListener
*
* @author Arkadiusz Krakowiak
*/
-class StoreOrderIdListenerSpec extends ObjectBehavior
+class CheckoutCompleteListenerSpec extends ObjectBehavior
{
function let(SessionInterface $session)
{
@@ -33,7 +33,7 @@ class StoreOrderIdListenerSpec extends ObjectBehavior
function it_is_initializable()
{
- $this->shouldHaveType('Sylius\Bundle\CoreBundle\EventListener\StoreOrderIdListener');
+ $this->shouldHaveType('Sylius\Bundle\ShopBundle\EventListener\CheckoutCompleteListener');
}
function it_sets_order_id_in_session(SessionInterface $session, OrderInterface $order, GenericEvent $event)
@@ -42,7 +42,7 @@ class StoreOrderIdListenerSpec extends ObjectBehavior
$order->getId()->willReturn(1);
$session->set('sylius_order_id', 1)->shouldBeCalled();
- $this->setOrderId($event);
+ $this->onCheckoutComplete($event);
}
function it_throws_invalid_argument_exception_if_subject_is_not_an_order(
@@ -53,6 +53,6 @@ class StoreOrderIdListenerSpec extends ObjectBehavior
$event->getSubject()->willReturn($country);
$session->set('sylius_order_id', Argument::any())->shouldNotBeCalled();
- $this->shouldThrow(\InvalidArgumentException::class)->during('setOrderId', [$event]);
+ $this->shouldThrow(\InvalidArgumentException::class)->during('onCheckoutComplete', [$event]);
}
}