Skip to content

Commit

Permalink
Introduce Resource manager, factory and dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Paweł Jędrzejewski committed Jan 3, 2015
1 parent dcb1e57 commit c92b762
Show file tree
Hide file tree
Showing 97 changed files with 1,340 additions and 1,441 deletions.
8 changes: 4 additions & 4 deletions src/Sylius/Bundle/CartBundle/EventListener/CartListener.php
Expand Up @@ -11,11 +11,11 @@

namespace Sylius\Bundle\CartBundle\EventListener;

use Doctrine\Common\Persistence\ObjectManager;
use Sylius\Component\Cart\Event\CartEvent;
use Sylius\Component\Cart\Event\CartItemEvent;
use Sylius\Component\Cart\Provider\CartProviderInterface;
use Sylius\Component\Cart\SyliusCartEvents;
use Sylius\Component\Resource\Manager\ResourceManagerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Validator\ValidatorInterface;

Expand All @@ -29,7 +29,7 @@ class CartListener implements EventSubscriberInterface
/**
* Cart manager.
*
* @var ObjectManager
* @var ResourceManagerInterface
*/
protected $cartManager;

Expand All @@ -50,11 +50,11 @@ class CartListener implements EventSubscriberInterface
/**
* Constructor.
*
* @param ObjectManager $cartManager
* @param ResourceManagerInterface $cartManager
* @param ValidatorInterface $validator
* @param CartProviderInterface $cartProvider
*/
public function __construct(ObjectManager $cartManager, ValidatorInterface $validator, CartProviderInterface $cartProvider)
public function __construct(ResourceManagerInterface $cartManager, ValidatorInterface $validator, CartProviderInterface $cartProvider)
{
$this->cartManager = $cartManager;
$this->validator = $validator;
Expand Down
14 changes: 7 additions & 7 deletions src/Sylius/Bundle/CartBundle/Provider/CartProvider.php
Expand Up @@ -11,13 +11,13 @@

namespace Sylius\Bundle\CartBundle\Provider;

use Doctrine\Common\Persistence\ObjectManager;
use Sylius\Component\Cart\Context\CartContextInterface;
use Sylius\Component\Cart\Event\CartEvent;
use Sylius\Component\Cart\Model\CartInterface;
use Sylius\Component\Cart\Provider\CartProviderInterface;
use Sylius\Component\Cart\SyliusCartEvents;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Sylius\Component\Resource\Repository\ResourceRepositoryInterface;
use Sylius\Component\Resource\Manager\ResourceManagerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
Expand All @@ -37,14 +37,14 @@ class CartProvider implements CartProviderInterface
/**
* Cart manager.
*
* @var ObjectManager
* @var ResourceManagerInterface
*/
protected $manager;

/**
* Cart repository.
*
* @var RepositoryInterface
* @var ResourceRepositoryInterface
*/
protected $repository;

Expand All @@ -66,11 +66,11 @@ class CartProvider implements CartProviderInterface
* Constructor.
*
* @param CartContextInterface $context
* @param ObjectManager $manager
* @param RepositoryInterface $repository
* @param ResourceManagerInterface $manager
* @param ResourceRepositoryInterface $repository
* @param EventDispatcherInterface $eventDispatcher
*/
public function __construct(CartContextInterface $context, ObjectManager $manager, RepositoryInterface $repository, EventDispatcherInterface $eventDispatcher)
public function __construct(CartContextInterface $context, ResourceManagerInterface $manager, ResourceRepositoryInterface $repository, EventDispatcherInterface $eventDispatcher)
{
$this->context = $context;
$this->manager = $manager;
Expand Down
6 changes: 3 additions & 3 deletions src/Sylius/Bundle/CartBundle/Purger/ExpiredCartsPurger.php
Expand Up @@ -11,7 +11,7 @@

namespace Sylius\Bundle\CartBundle\Purger;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\Persistence\ResourceManagerInterface;
use Sylius\Bundle\CartBundle\Repository\CartRepositoryInterface;
use Sylius\Component\Cart\Model\CartInterface;
use Sylius\Component\Cart\Purger\PurgerInterface;
Expand All @@ -26,7 +26,7 @@ class ExpiredCartsPurger implements PurgerInterface
/**
* Cart manager.
*
* @var ObjectManager
* @var ResourceManagerInterface
*/
protected $manager;

Expand All @@ -37,7 +37,7 @@ class ExpiredCartsPurger implements PurgerInterface
*/
protected $repository;

public function __construct(ObjectManager $manager, CartRepositoryInterface $repository)
public function __construct(ResourceManagerInterface $manager, CartRepositoryInterface $repository)
{
$this->manager = $manager;
$this->repository = $repository;
Expand Down
8 changes: 4 additions & 4 deletions src/Sylius/Bundle/CartBundle/Templating/Helper/CartHelper.php
Expand Up @@ -13,7 +13,7 @@

use Sylius\Component\Cart\Model\CartInterface;
use Sylius\Component\Cart\Provider\CartProviderInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Sylius\Component\Resource\Repository\ResourceRepositoryInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Templating\Helper\Helper;
Expand All @@ -30,7 +30,7 @@ class CartHelper extends Helper
/**
* Cart item manager.
*
* @var RepositoryInterface
* @var ResourceRepositoryInterface
*/
protected $cartItemRepository;

Expand All @@ -45,10 +45,10 @@ class CartHelper extends Helper
* Constructor.
*
* @param CartProviderInterface $cartProvider
* @param RepositoryInterface $cartItemRepository
* @param ResourceRepositoryInterface $cartItemRepository
* @param FormFactoryInterface $formFactory
*/
public function __construct(CartProviderInterface $cartProvider, RepositoryInterface $cartItemRepository, FormFactoryInterface $formFactory)
public function __construct(CartProviderInterface $cartProvider, ResourceRepositoryInterface $cartItemRepository, FormFactoryInterface $formFactory)
{
$this->cartProvider = $cartProvider;
$this->cartItemRepository = $cartItemRepository;
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace spec\Sylius\Bundle\CartBundle\EventListener;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\Persistence\ResourceManagerInterface;
use PhpSpec\ObjectBehavior;
use Sylius\Component\Cart\Event\CartEvent;
use Sylius\Component\Cart\Event\CartItemEvent;
Expand All @@ -27,7 +27,7 @@
*/
class CartListenerSpec extends ObjectBehavior
{
function let(ObjectManager $manager, ValidatorInterface $validator, CartProviderInterface $provider)
function let(ResourceManagerInterface $manager, ValidatorInterface $validator, CartProviderInterface $provider)
{
$this->beConstructedWith($manager, $validator, $provider);
}
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace spec\Sylius\Bundle\CartBundle\Provider;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\Persistence\ResourceManagerInterface;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Component\Cart\Context\CartContextInterface;
Expand All @@ -27,7 +27,7 @@ class CartProviderSpec extends ObjectBehavior
{
function let(
CartContextInterface $context,
ObjectManager $manager,
ResourceManagerInterface $manager,
RepositoryInterface $repository,
EventDispatcherInterface $eventDispatcher
) {
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Bundle/CoreBundle/Checkout/Step/CheckoutStep.php
Expand Up @@ -11,7 +11,7 @@

namespace Sylius\Bundle\CoreBundle\Checkout\Step;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\Persistence\ResourceManagerInterface;
use Sylius\Bundle\FlowBundle\Process\Step\ControllerStep;
use Sylius\Component\Addressing\Matcher\ZoneMatcherInterface;
use Sylius\Component\Cart\Provider\CartProviderInterface;
Expand Down Expand Up @@ -50,7 +50,7 @@ protected function getCurrentCart()
/**
* Get object manager.
*
* @return ObjectManager
* @return ResourceManagerInterface
*/
protected function getManager()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Bundle/CoreBundle/Context/CurrencyContext.php
Expand Up @@ -11,9 +11,9 @@

namespace Sylius\Bundle\CoreBundle\Context;

use Doctrine\Common\Persistence\ObjectManager;
use Sylius\Bundle\SettingsBundle\Manager\SettingsManagerInterface;
use Sylius\Component\Currency\Context\CurrencyContext as BaseCurrencyContext;
use Sylius\Component\Resource\Manager\ResourceManagerInterface;
use Sylius\Component\Storage\StorageInterface;
use Symfony\Component\Security\Core\SecurityContextInterface;

Expand All @@ -27,7 +27,7 @@ public function __construct(
StorageInterface $storage,
SecurityContextInterface $securityContext,
SettingsManagerInterface $settingsManager,
ObjectManager $userManager
ResourceManagerInterface $userManager
) {
$this->securityContext = $securityContext;
$this->settingsManager = $settingsManager;
Expand Down
Expand Up @@ -11,9 +11,9 @@

namespace Sylius\Bundle\CoreBundle\Doctrine\ORM;

use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\ResourceRepository;

class ShipmentRepository extends EntityRepository
class ShipmentRepository extends ResourceRepository
{
/**
* Create filter paginator.
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Sylius\Bundle\CoreBundle\EventListener;

use Doctrine\Common\Persistence\ObjectManager;
use Sylius\Component\Resource\Manager\ResourceManagerInterface;
use Sylius\Component\Addressing\Checker\RestrictedZoneCheckerInterface;
use Sylius\Component\Cart\Model\CartInterface;
use Sylius\Component\Cart\Provider\CartProviderInterface;
Expand All @@ -27,7 +27,7 @@ class RestrictedZoneListener
private $session;
private $translator;

public function __construct(RestrictedZoneCheckerInterface $restrictedZoneChecker, CartProviderInterface $cartProvider, ObjectManager $cartManager, SessionInterface $session, TranslatorInterface $translator)
public function __construct(RestrictedZoneCheckerInterface $restrictedZoneChecker, CartProviderInterface $cartProvider, ResourceManagerInterface $cartManager, SessionInterface $session, TranslatorInterface $translator)
{
$this->restrictedZoneChecker = $restrictedZoneChecker;
$this->cartProvider = $cartProvider;
Expand Down
8 changes: 4 additions & 4 deletions src/Sylius/Bundle/CoreBundle/OAuth/UserProvider.php
Expand Up @@ -17,7 +17,7 @@
use HWI\Bundle\OAuthBundle\Security\Core\User\FOSUBUserProvider;
use Sylius\Component\Core\Model\UserInterface as SyliusUserInterface;
use Sylius\Component\Core\Model\UserOAuthInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Sylius\Component\Resource\Repository\ResourceRepositoryInterface;
use Symfony\Component\Security\Core\User\UserInterface;

/**
Expand All @@ -29,17 +29,17 @@
class UserProvider extends FOSUBUserProvider
{
/**
* @var RepositoryInterface
* @var ResourceRepositoryInterface
*/
protected $oauthRepository;

/**
* Constructor.
*
* @param UserManagerInterface $userManager FOSUB user provider.
* @param RepositoryInterface $oauthRepository
* @param ResourceRepositoryInterface $oauthRepository
*/
public function __construct(UserManagerInterface $userManager, RepositoryInterface $oauthRepository)
public function __construct(UserManagerInterface $userManager, ResourceRepositoryInterface $oauthRepository)
{
$this->userManager = $userManager;
$this->oauthRepository = $oauthRepository;
Expand Down
Expand Up @@ -16,7 +16,7 @@
use Sylius\Component\Core\Model\AdjustmentInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\OrderProcessing\TaxationProcessorInterface;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Sylius\Component\Resource\Repository\ResourceRepositoryInterface;
use Sylius\Component\Taxation\Calculator\CalculatorInterface;
use Sylius\Component\Taxation\Resolver\TaxRateResolverInterface;

Expand All @@ -30,7 +30,7 @@ class TaxationProcessor implements TaxationProcessorInterface
/**
* Adjustment repository.
*
* @var RepositoryInterface
* @var ResourceRepositoryInterface
*/
protected $adjustmentRepository;

Expand Down Expand Up @@ -65,14 +65,14 @@ class TaxationProcessor implements TaxationProcessorInterface
/**
* Constructor.
*
* @param RepositoryInterface $adjustmentRepository
* @param ResourceRepositoryInterface $adjustmentRepository
* @param CalculatorInterface $calculator
* @param TaxRateResolverInterface $taxRateResolver
* @param ZoneMatcherInterface $zoneMatcher
* @param Settings $taxationSettings
*/
public function __construct(
RepositoryInterface $adjustmentRepository,
ResourceRepositoryInterface $adjustmentRepository,
CalculatorInterface $calculator,
TaxRateResolverInterface $taxRateResolver,
ZoneMatcherInterface $zoneMatcher,
Expand Down
6 changes: 3 additions & 3 deletions src/Sylius/Bundle/CoreBundle/Purger/ExpiredOrdersPurger.php
Expand Up @@ -11,7 +11,7 @@

namespace Sylius\Bundle\CoreBundle\Purger;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\Persistence\ResourceManagerInterface;
use SM\Factory\FactoryInterface;
use Sylius\Component\Cart\Purger\PurgerInterface;
use Sylius\Component\Core\Model\InventoryUnitInterface;
Expand All @@ -29,7 +29,7 @@ class ExpiredOrdersPurger implements PurgerInterface
/**
* Order manager.
*
* @var ObjectManager
* @var ResourceManagerInterface
*/
protected $manager;

Expand All @@ -52,7 +52,7 @@ class ExpiredOrdersPurger implements PurgerInterface
*/
protected $factory;

public function __construct(ObjectManager $manager, OrderRepositoryInterface $repository, FactoryInterface $factory)
public function __construct(ResourceManagerInterface $manager, OrderRepositoryInterface $repository, FactoryInterface $factory)
{
$this->manager = $manager;
$this->repository = $repository;
Expand Down
Expand Up @@ -11,7 +11,7 @@

namespace Sylius\Bundle\CoreBundle\Releaser;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\Persistence\ResourceManagerInterface;
use SM\Factory\FactoryInterface;
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
use Sylius\Component\Order\OrderTransitions;
Expand All @@ -26,7 +26,7 @@ class ExpiredOrdersReleaser implements ReleaserInterface
/**
* Order manager.
*
* @var ObjectManager
* @var ResourceManagerInterface
*/
protected $manager;

Expand All @@ -42,7 +42,7 @@ class ExpiredOrdersReleaser implements ReleaserInterface
*/
protected $factory;

public function __construct(ObjectManager $manager, OrderRepositoryInterface $repository, FactoryInterface $factory)
public function __construct(ResourceManagerInterface $manager, OrderRepositoryInterface $repository, FactoryInterface $factory)
{
$this->manager = $manager;
$this->repository = $repository;
Expand Down
2 changes: 1 addition & 1 deletion src/Sylius/Bundle/CoreBundle/Routing/RouteProvider.php
Expand Up @@ -12,8 +12,8 @@
namespace Sylius\Bundle\CoreBundle\Routing;

use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\Common\Util\ClassUtils;
use Sylius\Component\Resource\Repository\ResourceRepositoryInterface;
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\DoctrineProvider;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
Expand Down

0 comments on commit c92b762

Please sign in to comment.