diff --git a/app/config/eccube/services.yaml b/app/config/eccube/services.yaml index 50b13587307..1c950e10084 100644 --- a/app/config/eccube/services.yaml +++ b/app/config/eccube/services.yaml @@ -147,8 +147,6 @@ services: - { name: kernel.event_listener, event: kernel.request, priority: 1024 } Symfony\Component\HttpFoundation\ParameterBag: - Eccube\Entity\BaseInfo: - factory: ['@Eccube\Repository\BaseInfoRepository', 'get'] Eccube\Twig\Extension\IgnoreRoutingNotFoundExtension: # Symfony\Bridge\Twig\Extension\RoutingExtensionの後に登録するため, diff --git a/src/Eccube/Controller/Admin/Product/CsvImportController.php b/src/Eccube/Controller/Admin/Product/CsvImportController.php index a3b806d96cd..96ba5b30c03 100644 --- a/src/Eccube/Controller/Admin/Product/CsvImportController.php +++ b/src/Eccube/Controller/Admin/Product/CsvImportController.php @@ -26,6 +26,7 @@ use Eccube\Entity\ProductTag; use Eccube\Exception\CsvImportException; use Eccube\Form\Type\Admin\CsvImportType; +use Eccube\Repository\BaseInfoRepository; use Eccube\Repository\CategoryRepository; use Eccube\Repository\ClassCategoryRepository; use Eccube\Repository\DeliveryDurationRepository; @@ -95,9 +96,9 @@ class CsvImportController extends AbstractCsvImportController * @param ClassCategoryRepository $classCategoryRepository * @param ProductStatusRepository $productStatusRepository * @param ProductRepository $productRepository - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository */ - public function __construct(DeliveryDurationRepository $deliveryDurationRepository, SaleTypeRepository $saleTypeRepository, TagRepository $tagRepository, CategoryRepository $categoryRepository, ClassCategoryRepository $classCategoryRepository, ProductStatusRepository $productStatusRepository, ProductRepository $productRepository, BaseInfo $BaseInfo) + public function __construct(DeliveryDurationRepository $deliveryDurationRepository, SaleTypeRepository $saleTypeRepository, TagRepository $tagRepository, CategoryRepository $categoryRepository, ClassCategoryRepository $classCategoryRepository, ProductStatusRepository $productStatusRepository, ProductRepository $productRepository, BaseInfoRepository $baseInfoRepository) { $this->deliveryDurationRepository = $deliveryDurationRepository; $this->saleTypeRepository = $saleTypeRepository; @@ -106,7 +107,7 @@ public function __construct(DeliveryDurationRepository $deliveryDurationReposito $this->classCategoryRepository = $classCategoryRepository; $this->productStatusRepository = $productStatusRepository; $this->productRepository = $productRepository; - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); } /** diff --git a/src/Eccube/Controller/Admin/Product/ProductController.php b/src/Eccube/Controller/Admin/Product/ProductController.php index 4d694f24ce7..6fa46f6e1f7 100644 --- a/src/Eccube/Controller/Admin/Product/ProductController.php +++ b/src/Eccube/Controller/Admin/Product/ProductController.php @@ -30,6 +30,7 @@ use Eccube\Event\EventArgs; use Eccube\Form\Type\Admin\ProductType; use Eccube\Form\Type\Admin\SearchProductType; +use Eccube\Repository\BaseInfoRepository; use Eccube\Repository\CategoryRepository; use Eccube\Repository\Master\PageMaxRepository; use Eccube\Repository\Master\ProductStatusRepository; @@ -87,9 +88,9 @@ class ProductController extends AbstractController protected $productRepository; /** - * @var BaseInfo + * @var BaseInfoRepository */ - protected $BaseInfo; + protected $baseInfoRepository; /** * @var PageMaxRepository @@ -115,7 +116,7 @@ class ProductController extends AbstractController * @param TaxRuleRepository $taxRuleRepository * @param CategoryRepository $categoryRepository * @param ProductRepository $productRepository - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository * @param PageMaxRepository $pageMaxRepository * @param ProductStatusRepository $productStatusRepository * @param TagRepository $tagRepository @@ -127,7 +128,7 @@ public function __construct( TaxRuleRepository $taxRuleRepository, CategoryRepository $categoryRepository, ProductRepository $productRepository, - BaseInfo $BaseInfo, + BaseInfoRepository $baseInfoRepository, PageMaxRepository $pageMaxRepository, ProductStatusRepository $productStatusRepository, TagRepository $tagRepository @@ -138,7 +139,7 @@ public function __construct( $this->taxRuleRepository = $taxRuleRepository; $this->categoryRepository = $categoryRepository; $this->productRepository = $productRepository; - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); $this->pageMaxRepository = $pageMaxRepository; $this->productStatusRepository = $productStatusRepository; $this->tagRepository = $tagRepository; diff --git a/src/Eccube/Controller/Admin/Setting/Shop/ShopController.php b/src/Eccube/Controller/Admin/Setting/Shop/ShopController.php index bacc441bb4c..adc2dee99b0 100644 --- a/src/Eccube/Controller/Admin/Setting/Shop/ShopController.php +++ b/src/Eccube/Controller/Admin/Setting/Shop/ShopController.php @@ -18,6 +18,7 @@ use Eccube\Event\EccubeEvents; use Eccube\Event\EventArgs; use Eccube\Form\Type\Admin\ShopMasterType; +use Eccube\Repository\BaseInfoRepository; use Eccube\Util\CacheUtil; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template; @@ -42,11 +43,12 @@ class ShopController extends AbstractController /** * ShopController constructor. * - * @param BaseInfo $BaseInfo + * @param Twig_Environment $twig + * @param BaseInfoRepository $baseInfoRepository */ - public function __construct(Twig_Environment $twig, BaseInfo $BaseInfo) + public function __construct(Twig_Environment $twig, BaseInfoRepository $baseInfoRepository) { - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); $this->twig = $twig; } diff --git a/src/Eccube/Controller/Admin/Setting/Shop/TaxRuleController.php b/src/Eccube/Controller/Admin/Setting/Shop/TaxRuleController.php index 0aa0301000a..0156a603835 100644 --- a/src/Eccube/Controller/Admin/Setting/Shop/TaxRuleController.php +++ b/src/Eccube/Controller/Admin/Setting/Shop/TaxRuleController.php @@ -19,6 +19,7 @@ use Eccube\Event\EccubeEvents; use Eccube\Event\EventArgs; use Eccube\Form\Type\Admin\TaxRuleType; +use Eccube\Repository\BaseInfoRepository; use Eccube\Repository\TaxRuleRepository; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; @@ -44,12 +45,12 @@ class TaxRuleController extends AbstractController /** * TaxRuleController constructor. * - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository * @param TaxRuleRepository $taxRuleRepository */ - public function __construct(BaseInfo $BaseInfo, TaxRuleRepository $taxRuleRepository) + public function __construct(BaseInfoRepository $baseInfoRepository, TaxRuleRepository $taxRuleRepository) { - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); $this->taxRuleRepository = $taxRuleRepository; } diff --git a/src/Eccube/Controller/Admin/Store/PluginController.php b/src/Eccube/Controller/Admin/Store/PluginController.php index 4412ad76bb0..f97b24d4293 100644 --- a/src/Eccube/Controller/Admin/Store/PluginController.php +++ b/src/Eccube/Controller/Admin/Store/PluginController.php @@ -21,6 +21,7 @@ use Eccube\Exception\PluginException; use Eccube\Form\Type\Admin\PluginLocalInstallType; use Eccube\Form\Type\Admin\PluginManagementType; +use Eccube\Repository\BaseInfoRepository; use Eccube\Repository\PluginEventHandlerRepository; use Eccube\Repository\PluginRepository; use Eccube\Service\PluginService; @@ -67,14 +68,14 @@ class PluginController extends AbstractController * * @param PluginRepository $pluginRepository * @param PluginService $pluginService - * @param BaseInfo $baseInfo + * @param BaseInfoRepository $baseInfoRepository */ - public function __construct(PluginRepository $pluginRepository, PluginService $pluginService, PluginEventHandlerRepository $eventHandlerRepository, BaseInfo $baseInfo) + public function __construct(PluginRepository $pluginRepository, PluginService $pluginService, PluginEventHandlerRepository $eventHandlerRepository, BaseInfoRepository $baseInfoRepository) { $this->pluginRepository = $pluginRepository; $this->pluginService = $pluginService; $this->pluginEventHandlerRepository = $eventHandlerRepository; - $this->BaseInfo = $baseInfo; + $this->BaseInfo = $baseInfoRepository->get(); } /** diff --git a/src/Eccube/Controller/CartController.php b/src/Eccube/Controller/CartController.php index 23c97cf3f40..dd4616f8ecc 100644 --- a/src/Eccube/Controller/CartController.php +++ b/src/Eccube/Controller/CartController.php @@ -18,6 +18,7 @@ use Eccube\Entity\ProductClass; use Eccube\Event\EccubeEvents; use Eccube\Event\EventArgs; +use Eccube\Repository\BaseInfoRepository; use Eccube\Repository\ProductClassRepository; use Eccube\Service\CartService; use Eccube\Service\PurchaseFlow\PurchaseContext; @@ -56,18 +57,18 @@ class CartController extends AbstractController * @param ProductClassRepository $productClassRepository * @param CartService $cartService * @param PurchaseFlow $cartPurchaseFlow - * @param BaseInfo $baseInfo + * @param BaseInfoRepository $baseInfoRepository */ public function __construct( ProductClassRepository $productClassRepository, CartService $cartService, PurchaseFlow $cartPurchaseFlow, - BaseInfo $baseInfo + BaseInfoRepository $baseInfoRepository ) { $this->productClassRepository = $productClassRepository; $this->cartService = $cartService; $this->purchaseFlow = $cartPurchaseFlow; - $this->baseInfo = $baseInfo; + $this->baseInfo = $baseInfoRepository->get(); } /** diff --git a/src/Eccube/Controller/EntryController.php b/src/Eccube/Controller/EntryController.php index 3a531d6f2b4..5882a4cc66e 100644 --- a/src/Eccube/Controller/EntryController.php +++ b/src/Eccube/Controller/EntryController.php @@ -18,6 +18,7 @@ use Eccube\Event\EccubeEvents; use Eccube\Event\EventArgs; use Eccube\Form\Type\Front\EntryType; +use Eccube\Repository\BaseInfoRepository; use Eccube\Repository\CustomerRepository; use Eccube\Repository\Master\CustomerStatusRepository; use Eccube\Service\MailService; @@ -73,7 +74,7 @@ class EntryController extends AbstractController * * @param CustomerStatusRepository $customerStatusRepository * @param MailService $mailService - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository * @param CustomerRepository $customerRepository * @param EncoderFactoryInterface $encoderFactory * @param ValidatorInterface $validatorInterface @@ -82,7 +83,7 @@ class EntryController extends AbstractController public function __construct( CustomerStatusRepository $customerStatusRepository, MailService $mailService, - BaseInfo $BaseInfo, + BaseInfoRepository $baseInfoRepository, CustomerRepository $customerRepository, EncoderFactoryInterface $encoderFactory, ValidatorInterface $validatorInterface, @@ -90,7 +91,7 @@ public function __construct( ) { $this->customerStatusRepository = $customerStatusRepository; $this->mailService = $mailService; - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); $this->customerRepository = $customerRepository; $this->encoderFactory = $encoderFactory; $this->recursiveValidator = $validatorInterface; diff --git a/src/Eccube/Controller/Mypage/DeliveryController.php b/src/Eccube/Controller/Mypage/DeliveryController.php index 6edbd350684..a4fc90c0c3d 100644 --- a/src/Eccube/Controller/Mypage/DeliveryController.php +++ b/src/Eccube/Controller/Mypage/DeliveryController.php @@ -19,6 +19,7 @@ use Eccube\Event\EccubeEvents; use Eccube\Event\EventArgs; use Eccube\Form\Type\Front\CustomerAddressType; +use Eccube\Repository\BaseInfoRepository; use Eccube\Repository\CustomerAddressRepository; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; @@ -39,9 +40,9 @@ class DeliveryController extends AbstractController */ protected $customerAddressRepository; - public function __construct(BaseInfo $baseInfo, CustomerAddressRepository $customerAddressRepository) + public function __construct(BaseInfoRepository $baseInfoRepository, CustomerAddressRepository $customerAddressRepository) { - $this->BaseInfo = $baseInfo; + $this->BaseInfo = $baseInfoRepository->get(); $this->customerAddressRepository = $customerAddressRepository; } diff --git a/src/Eccube/Controller/Mypage/MypageController.php b/src/Eccube/Controller/Mypage/MypageController.php index 7394bd2f3ae..7f1b2188d28 100644 --- a/src/Eccube/Controller/Mypage/MypageController.php +++ b/src/Eccube/Controller/Mypage/MypageController.php @@ -21,6 +21,7 @@ use Eccube\Event\EventArgs; use Eccube\Exception\CartException; use Eccube\Form\Type\Front\CustomerLoginType; +use Eccube\Repository\BaseInfoRepository; use Eccube\Repository\CustomerFavoriteProductRepository; use Eccube\Repository\OrderRepository; use Eccube\Repository\ProductRepository; @@ -74,19 +75,19 @@ class MypageController extends AbstractController * @param OrderRepository $orderRepository * @param CustomerFavoriteProductRepository $customerFavoriteProductRepository * @param CartService $cartService - * @param BaseInfo $baseInfo + * @param BaseInfoRepository $baseInfoRepository * @param PurchaseFlow $purchaseFlow */ public function __construct( OrderRepository $orderRepository, CustomerFavoriteProductRepository $customerFavoriteProductRepository, CartService $cartService, - BaseInfo $baseInfo, + BaseInfoRepository $baseInfoRepository, PurchaseFlow $purchaseFlow ) { $this->orderRepository = $orderRepository; $this->customerFavoriteProductRepository = $customerFavoriteProductRepository; - $this->BaseInfo = $baseInfo; + $this->BaseInfo = $baseInfoRepository->get(); $this->cartService = $cartService; $this->purchaseFlow = $purchaseFlow; } diff --git a/src/Eccube/Controller/ProductController.php b/src/Eccube/Controller/ProductController.php index 2bc9e669d1b..cb69e54cf47 100644 --- a/src/Eccube/Controller/ProductController.php +++ b/src/Eccube/Controller/ProductController.php @@ -22,6 +22,7 @@ use Eccube\Form\Type\Master\ProductListMaxType; use Eccube\Form\Type\Master\ProductListOrderByType; use Eccube\Form\Type\SearchProductType; +use Eccube\Repository\BaseInfoRepository; use Eccube\Repository\CustomerFavoriteProductRepository; use Eccube\Repository\ProductRepository; use Eccube\Service\CartService; @@ -77,7 +78,7 @@ class ProductController extends AbstractController * @param CustomerFavoriteProductRepository $customerFavoriteProductRepository * @param CartService $cartService * @param ProductRepository $productRepository - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository * @param AuthenticationUtils $helper */ public function __construct( @@ -85,14 +86,14 @@ public function __construct( CustomerFavoriteProductRepository $customerFavoriteProductRepository, CartService $cartService, ProductRepository $productRepository, - BaseInfo $BaseInfo, + BaseInfoRepository $baseInfoRepository, AuthenticationUtils $helper ) { $this->purchaseFlow = $cartPurchaseFlow; $this->customerFavoriteProductRepository = $customerFavoriteProductRepository; $this->cartService = $cartService; $this->productRepository = $productRepository; - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); $this->helper = $helper; } diff --git a/src/Eccube/Form/Type/Admin/OrderItemType.php b/src/Eccube/Form/Type/Admin/OrderItemType.php index 0426c87152f..89c18fd2c0d 100644 --- a/src/Eccube/Form/Type/Admin/OrderItemType.php +++ b/src/Eccube/Form/Type/Admin/OrderItemType.php @@ -93,7 +93,7 @@ class OrderItemType extends AbstractType public function __construct( EntityManagerInterface $entityManager, EccubeConfig $eccubeConfig, - BaseInfo $BaseInfo, + BaseInfoRepository $baseInfoRepository, ProductClassRepository $productClassRepository, OrderItemRepository $orderItemRepository, OrderItemTypeRepository $orderItemTypeRepository, @@ -102,7 +102,7 @@ public function __construct( ) { $this->entityManager = $entityManager; $this->eccubeConfig = $eccubeConfig; - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); $this->productClassRepository = $productClassRepository; $this->orderItemRepository = $orderItemRepository; $this->orderItemTypeRepository = $orderItemTypeRepository; diff --git a/src/Eccube/Form/Type/Admin/ShippingType.php b/src/Eccube/Form/Type/Admin/ShippingType.php index 0ca7e501712..7ffd6dc7c80 100644 --- a/src/Eccube/Form/Type/Admin/ShippingType.php +++ b/src/Eccube/Form/Type/Admin/ShippingType.php @@ -22,6 +22,7 @@ use Eccube\Form\Type\NameType; use Eccube\Form\Type\PhoneNumberType; use Eccube\Form\Type\PostalType; +use Eccube\Repository\BaseInfoRepository; use Eccube\Repository\DeliveryRepository; use Eccube\Repository\DeliveryTimeRepository; use Eccube\Util\StringUtil; @@ -66,18 +67,18 @@ class ShippingType extends AbstractType * @param EccubeConfig $eccubeConfig * @param DeliveryRepository $deliveryRepository * @param DeliveryTimeRepository $deliveryTimeRepository - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository */ public function __construct( EccubeConfig $eccubeConfig, DeliveryRepository $deliveryRepository, DeliveryTimeRepository $deliveryTimeRepository, - BaseInfo $BaseInfo + BaseInfoRepository $baseInfoRepository ) { $this->eccubeConfig = $eccubeConfig; $this->deliveryRepository = $deliveryRepository; $this->deliveryTimeRepository = $deliveryTimeRepository; - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); } /** diff --git a/src/Eccube/Repository/TaxRuleRepository.php b/src/Eccube/Repository/TaxRuleRepository.php index 0d0d74f0fd5..b22d9d19237 100644 --- a/src/Eccube/Repository/TaxRuleRepository.php +++ b/src/Eccube/Repository/TaxRuleRepository.php @@ -18,6 +18,7 @@ use Eccube\Entity\BaseInfo; use Eccube\Entity\Customer; use Eccube\Entity\TaxRule; +use Eccube\Repository\BaseInfoRepository; use Symfony\Bridge\Doctrine\RegistryInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; @@ -53,20 +54,20 @@ class TaxRuleRepository extends AbstractRepository * @param RegistryInterface $registry * @param TokenStorageInterface $tokenStorage * @param AuthorizationCheckerInterface $authorizationChecker - * @param BaseInfo $baseInfo + * @param BaseInfoRepository $baseInfoRepository * @param EccubeConfig $eccubeConfig */ public function __construct( RegistryInterface $registry, TokenStorageInterface $tokenStorage, AuthorizationCheckerInterface $authorizationChecker, - BaseInfo $baseInfo, + BaseInfoRepository $baseInfoRepository, EccubeConfig $eccubeConfig ) { parent::__construct($registry, TaxRule::class); $this->tokenStorage = $tokenStorage; $this->authorizationChecker = $authorizationChecker; - $this->baseInfo = $baseInfo; + $this->baseInfo = $baseInfoRepository->get(); $this->eccubeConfig = $eccubeConfig; } diff --git a/src/Eccube/Service/MailService.php b/src/Eccube/Service/MailService.php index 38bf786f46b..aa51030a0d2 100644 --- a/src/Eccube/Service/MailService.php +++ b/src/Eccube/Service/MailService.php @@ -23,6 +23,7 @@ use Eccube\Entity\Shipping; use Eccube\Event\EccubeEvents; use Eccube\Event\EventArgs; +use Eccube\Repository\BaseInfoRepository; use Eccube\Repository\MailHistoryRepository; use Eccube\Repository\MailTemplateRepository; use Symfony\Component\EventDispatcher\EventDispatcher; @@ -71,7 +72,7 @@ class MailService * @param \Swift_Mailer $mailer * @param MailTemplateRepository $mailTemplateRepository * @param MailHistoryRepository $mailHistoryRepository - * @param BaseInfo $baseInfo + * @param BaseInfoRepository $baseInfoRepository * @param EventDispatcherInterface $eventDispatcher * @param \Twig_Environment $twig * @param EccubeConfig $eccubeConfig @@ -80,7 +81,7 @@ public function __construct( \Swift_Mailer $mailer, MailTemplateRepository $mailTemplateRepository, MailHistoryRepository $mailHistoryRepository, - BaseInfo $baseInfo, + BaseInfoRepository $baseInfoRepository, EventDispatcherInterface $eventDispatcher, \Twig_Environment $twig, EccubeConfig $eccubeConfig @@ -88,7 +89,7 @@ public function __construct( $this->mailer = $mailer; $this->mailTemplateRepository = $mailTemplateRepository; $this->mailHistoryRepository = $mailHistoryRepository; - $this->BaseInfo = $baseInfo; + $this->BaseInfo = $baseInfoRepository->get(); $this->eventDispatcher = $eventDispatcher; $this->eccubeConfig = $eccubeConfig; $this->twig = $twig; diff --git a/src/Eccube/Service/PurchaseFlow/Processor/AddPointProcessor.php b/src/Eccube/Service/PurchaseFlow/Processor/AddPointProcessor.php index adf16be80e6..c228cae986e 100644 --- a/src/Eccube/Service/PurchaseFlow/Processor/AddPointProcessor.php +++ b/src/Eccube/Service/PurchaseFlow/Processor/AddPointProcessor.php @@ -16,6 +16,7 @@ use Doctrine\ORM\EntityManagerInterface; use Eccube\Entity\BaseInfo; use Eccube\Entity\ItemHolderInterface; +use Eccube\Entity\BaseInfoRepository; use Eccube\Service\PurchaseFlow\ItemHolderProcessor; use Eccube\Service\PurchaseFlow\ProcessResult; use Eccube\Service\PurchaseFlow\PurchaseContext; @@ -39,12 +40,12 @@ class AddPointProcessor implements ItemHolderProcessor * AddPointProcessor constructor. * * @param EntityManagerInterface $entityManager - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository */ - public function __construct(EntityManagerInterface $entityManager, BaseInfo $BaseInfo) + public function __construct(EntityManagerInterface $entityManager, BaseInfoRepository $baseInfoRepository) { $this->entityManager = $entityManager; - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); } /** diff --git a/src/Eccube/Service/PurchaseFlow/Processor/DeliveryFeeFreeByShippingPreprocessor.php b/src/Eccube/Service/PurchaseFlow/Processor/DeliveryFeeFreeByShippingPreprocessor.php index 0735ff8dd99..0a2c5c207a2 100644 --- a/src/Eccube/Service/PurchaseFlow/Processor/DeliveryFeeFreeByShippingPreprocessor.php +++ b/src/Eccube/Service/PurchaseFlow/Processor/DeliveryFeeFreeByShippingPreprocessor.php @@ -16,6 +16,7 @@ use Eccube\Entity\BaseInfo; use Eccube\Entity\ItemHolderInterface; use Eccube\Entity\Order; +use Eccube\Repository\BaseInfoRepository; use Eccube\Service\PurchaseFlow\ItemHolderPreprocessor; use Eccube\Service\PurchaseFlow\PurchaseContext; @@ -33,11 +34,11 @@ class DeliveryFeeFreeByShippingPreprocessor implements ItemHolderPreprocessor /** * DeliveryFeeProcessor constructor. * - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository */ - public function __construct(BaseInfo $BaseInfo) + public function __construct(BaseInfoRepository $baseInfoRepository) { - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); } /** diff --git a/src/Eccube/Service/PurchaseFlow/Processor/DeliveryFeeFreePreprocessor.php b/src/Eccube/Service/PurchaseFlow/Processor/DeliveryFeeFreePreprocessor.php index 1fb81539d74..342195d2523 100644 --- a/src/Eccube/Service/PurchaseFlow/Processor/DeliveryFeeFreePreprocessor.php +++ b/src/Eccube/Service/PurchaseFlow/Processor/DeliveryFeeFreePreprocessor.php @@ -15,6 +15,7 @@ use Eccube\Entity\BaseInfo; use Eccube\Entity\ItemHolderInterface; +use Eccube\Repository\BaseInfoRepository; use Eccube\Service\PurchaseFlow\ItemHolderPreprocessor; use Eccube\Service\PurchaseFlow\PurchaseContext; @@ -31,11 +32,11 @@ class DeliveryFeeFreePreprocessor implements ItemHolderPreprocessor /** * DeliveryFeeProcessor constructor. * - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository */ - public function __construct(BaseInfo $BaseInfo) + public function __construct(BaseInfoRepository $baseInfoRepository) { - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); } /** diff --git a/src/Eccube/Service/PurchaseFlow/Processor/PointDiffProcessor.php b/src/Eccube/Service/PurchaseFlow/Processor/PointDiffProcessor.php index 6d3e2dae7d7..04e15d05c04 100644 --- a/src/Eccube/Service/PurchaseFlow/Processor/PointDiffProcessor.php +++ b/src/Eccube/Service/PurchaseFlow/Processor/PointDiffProcessor.php @@ -18,6 +18,7 @@ use Eccube\Entity\ItemHolderInterface; use Eccube\Entity\Master\OrderStatus; use Eccube\Entity\Order; +use Eccube\Repository\BaseInfoRepository; use Eccube\Service\PurchaseFlow\ItemHolderValidator; use Eccube\Service\PurchaseFlow\PurchaseContext; use Eccube\Service\PurchaseFlow\PurchaseProcessor; @@ -41,12 +42,12 @@ class PointDiffProcessor extends ItemHolderValidator implements PurchaseProcesso * AddPointProcessor constructor. * * @param EntityManagerInterface $entityManager - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository */ - public function __construct(EntityManagerInterface $entityManager, BaseInfo $BaseInfo) + public function __construct(EntityManagerInterface $entityManager, BaseInfoRepository $baseInfoRepository) { $this->entityManager = $entityManager; - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); } /* diff --git a/src/Eccube/Service/PurchaseFlow/Processor/PointProcessor.php b/src/Eccube/Service/PurchaseFlow/Processor/PointProcessor.php index 4e8f35ae49b..f4961b28098 100644 --- a/src/Eccube/Service/PurchaseFlow/Processor/PointProcessor.php +++ b/src/Eccube/Service/PurchaseFlow/Processor/PointProcessor.php @@ -22,6 +22,7 @@ use Eccube\Entity\Master\TaxType; use Eccube\Entity\Order; use Eccube\Entity\OrderItem; +use Eccube\Repository\BaseInfoRepository; use Eccube\Service\PurchaseFlow\ItemHolderPreprocessor; use Eccube\Service\PurchaseFlow\ItemHolderValidator; use Eccube\Service\PurchaseFlow\PurchaseContext; @@ -46,12 +47,12 @@ class PointProcessor extends ItemHolderValidator implements ItemHolderPreprocess * AddPointProcessor constructor. * * @param EntityManagerInterface $entityManager - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository */ - public function __construct(EntityManagerInterface $entityManager, BaseInfo $BaseInfo) + public function __construct(EntityManagerInterface $entityManager, BaseInfoRepository $baseInfoRepository) { $this->entityManager = $entityManager; - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); } /* diff --git a/src/Eccube/Service/PurchaseFlow/Processor/StockMultipleValidator.php b/src/Eccube/Service/PurchaseFlow/Processor/StockMultipleValidator.php index 58a17047c1e..9c813d4c9ac 100644 --- a/src/Eccube/Service/PurchaseFlow/Processor/StockMultipleValidator.php +++ b/src/Eccube/Service/PurchaseFlow/Processor/StockMultipleValidator.php @@ -52,6 +52,7 @@ public function validate(ItemHolderInterface $itemHolder, PurchaseContext $conte } foreach ($OrderItemsByProductClass as $id => $Items) { + /** @var ProductClass $ProductClass */ $ProductClass = $this->productClassRepository->find($id); if ($ProductClass->isStockUnlimited()) { continue; diff --git a/src/Eccube/Service/PurchaseFlow/Processor/UsePointProcessor.php b/src/Eccube/Service/PurchaseFlow/Processor/UsePointProcessor.php index 0b048beb595..d1d3df7d02a 100644 --- a/src/Eccube/Service/PurchaseFlow/Processor/UsePointProcessor.php +++ b/src/Eccube/Service/PurchaseFlow/Processor/UsePointProcessor.php @@ -21,6 +21,7 @@ use Eccube\Entity\Master\TaxType; use Eccube\Entity\Order; use Eccube\Entity\OrderItem; +use Eccube\Repository\BaseInfoRepository; use Eccube\Service\PurchaseFlow\ItemHolderProcessor; use Eccube\Service\PurchaseFlow\ProcessResult; use Eccube\Service\PurchaseFlow\PurchaseContext; @@ -44,12 +45,12 @@ class UsePointProcessor implements ItemHolderProcessor * UsePointProcessor constructor. * * @param EntityManagerInterface $entityManager - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository */ - public function __construct(EntityManagerInterface $entityManager, BaseInfo $BaseInfo) + public function __construct(EntityManagerInterface $entityManager, BaseInfoRepository $baseInfoRepository) { $this->entityManager = $entityManager; - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); } /** diff --git a/src/Eccube/Service/ShoppingService.php b/src/Eccube/Service/ShoppingService.php index 0a422bc4802..4fca8927202 100644 --- a/src/Eccube/Service/ShoppingService.php +++ b/src/Eccube/Service/ShoppingService.php @@ -32,6 +32,7 @@ use Eccube\Event\EventArgs; use Eccube\Exception\CartException; use Eccube\Form\Type\ShippingItemType; +use Eccube\Repository\BaseInfoRepository; use Eccube\Repository\CustomerAddressRepository; use Eccube\Repository\DeliveryFeeRepository; use Eccube\Repository\DeliveryRepository; @@ -189,7 +190,7 @@ class ShoppingService * @param OrderRepository $orderRepository * @param CartService $cartService * @param OrderService $orderService - * @param BaseInfo $BaseInfo + * @param BaseInfoRepository $baseInfoRepository * @param AuthorizationCheckerInterface $authorizationChecker * @param \Mobile_Detect $mobileDetect */ @@ -213,7 +214,7 @@ public function __construct( OrderRepository $orderRepository, CartService $cartService, OrderService $orderService, - BaseInfo $BaseInfo, + BaseInfoRepository $baseInfoRepository, AuthorizationCheckerInterface $authorizationChecker, \Mobile_Detect $mobileDetect ) { @@ -236,7 +237,7 @@ public function __construct( $this->orderRepository = $orderRepository; $this->cartService = $cartService; $this->orderService = $orderService; - $this->BaseInfo = $BaseInfo; + $this->BaseInfo = $baseInfoRepository->get(); $this->authorizationChecker = $authorizationChecker; $this->mobileDetect = $mobileDetect; } diff --git a/tests/Eccube/Tests/Repository/TaxRuleRepositoryTest.php b/tests/Eccube/Tests/Repository/TaxRuleRepositoryTest.php index 94afcd39315..26a1da3d035 100644 --- a/tests/Eccube/Tests/Repository/TaxRuleRepositoryTest.php +++ b/tests/Eccube/Tests/Repository/TaxRuleRepositoryTest.php @@ -88,7 +88,7 @@ public function setUp() parent::setUp(); - $this->BaseInfo = $this->container->get(BaseInfo::class); + $this->BaseInfo = $this->entityManager->find(BaseInfo::class, 1); $this->taxRuleRepository = $this->container->get(TaxRuleRepository::class); $this->memberRepository = $this->container->get(MemberRepository::class); $this->prefRepository = $this->container->get(PrefRepository::class); diff --git a/tests/Eccube/Tests/Service/MailServiceTest.php b/tests/Eccube/Tests/Service/MailServiceTest.php index 3f415c0a0bd..8ff84c93dd9 100644 --- a/tests/Eccube/Tests/Service/MailServiceTest.php +++ b/tests/Eccube/Tests/Service/MailServiceTest.php @@ -51,7 +51,7 @@ public function setUp() { parent::setUp(); $this->Customer = $this->createCustomer(); - $this->BaseInfo = $this->container->get(BaseInfo::class); + $this->BaseInfo = $this->entityManager->find(BaseInfo::class, 1); $this->mailService = $this->container->get(MailService::class); } diff --git a/tests/Eccube/Tests/Service/PurchaseFlow/Processor/DeliveryFeeFreeByShippingProcessorTest.php b/tests/Eccube/Tests/Service/PurchaseFlow/Processor/DeliveryFeeFreeByShippingProcessorTest.php index b5d39aa1101..e6beef3ad7d 100644 --- a/tests/Eccube/Tests/Service/PurchaseFlow/Processor/DeliveryFeeFreeByShippingProcessorTest.php +++ b/tests/Eccube/Tests/Service/PurchaseFlow/Processor/DeliveryFeeFreeByShippingProcessorTest.php @@ -18,6 +18,7 @@ use Eccube\Entity\Order; use Eccube\Entity\OrderItem; use Eccube\Entity\Shipping; +use Eccube\Repository\BaseInfoRepository; use Eccube\Service\PurchaseFlow\Processor\DeliveryFeeFreeByShippingPreprocessor; use Eccube\Service\PurchaseFlow\PurchaseContext; use Eccube\Tests\EccubeTestCase; @@ -29,11 +30,15 @@ class DeliveryFeeFreeByShippingProcessorTest extends EccubeTestCase private $DeliveryFeeType; + /** @var BaseInfoRepository */ + private $baseInfoRepository; + public function setUp() { parent::setUp(); $this->ProductType = $this->entityManager->find(OrderItemType::class, OrderItemType::PRODUCT); $this->DeliveryFeeType = $this->entityManager->find(OrderItemType::class, OrderItemType::DELIVERY_FEE); + $this->baseInfoRepository = $this->container->get(BaseInfoRepository::class); } /** @@ -41,7 +46,8 @@ public function setUp() */ public function testWithoutDeliveryFreeSettings() { - $processor = new DeliveryFeeFreeByShippingPreprocessor($this->newBaseInfo(0, 0)); + $this->newBaseInfo(0, 0); + $processor = new DeliveryFeeFreeByShippingPreprocessor($this->baseInfoRepository); $Order = new Order(); $Shipping = $this->newShipping(1); @@ -64,7 +70,8 @@ public function testWithoutDeliveryFreeSettings() */ public function testWithDeliveryFreeAmount($amount, $expectedFee) { - $processor = new DeliveryFeeFreeByShippingPreprocessor($this->newBaseInfo(1000, 0)); + $this->newBaseInfo(1000, 0); + $processor = new DeliveryFeeFreeByShippingPreprocessor($this->baseInfoRepository); $Shipping = $this->newShipping(1); $Order = new Order(); @@ -99,7 +106,8 @@ public function deliveryFreeAmountProvider() */ public function testWithDeliveryFreeQuantity($quantity, $expectedFee) { - $processor = new DeliveryFeeFreeByShippingPreprocessor($this->newBaseInfo(0, 10)); + $this->newBaseInfo(0, 10); + $processor = new DeliveryFeeFreeByShippingPreprocessor($this->baseInfoRepository); $Shipping = $this->newShipping(1); $Order = new Order(); @@ -129,7 +137,8 @@ public function deliveryFreeQuantityProvider() */ public function testMultipleShippingWithDeliveryFreeAmount() { - $processor = new DeliveryFeeFreeByShippingPreprocessor($this->newBaseInfo(1000, 0)); + $this->newBaseInfo(1000, 0); + $processor = new DeliveryFeeFreeByShippingPreprocessor($this->baseInfoRepository); $Shipping1 = $this->newShipping(1); $Shipping2 = $this->newShipping(2); @@ -159,7 +168,8 @@ public function testMultipleShippingWithDeliveryFreeAmount() */ public function testMultipleShippingWithDeliveryFreeQuantity() { - $processor = new DeliveryFeeFreeByShippingPreprocessor($this->newBaseInfo(0, 5)); + $this->newBaseInfo(0, 5); + $processor = new DeliveryFeeFreeByShippingPreprocessor($this->baseInfoRepository); $Shipping1 = $this->newShipping(1); $Shipping2 = $this->newShipping(2); @@ -186,10 +196,10 @@ public function testMultipleShippingWithDeliveryFreeQuantity() private function newBaseInfo($deliveryFeeAmount, $deliveryFeeQuantity) { - $BaseInfo = new BaseInfo(); + $BaseInfo = $this->entityManager->find(BaseInfo::class, 1); $BaseInfo->setDeliveryFreeAmount($deliveryFeeAmount); $BaseInfo->setDeliveryFreeQuantity($deliveryFeeQuantity); - + $this->entityManager->flush(); return $BaseInfo; } diff --git a/tests/Eccube/Tests/Service/PurchaseFlow/Processor/DeliveryFeeFreeProcessorTest.php b/tests/Eccube/Tests/Service/PurchaseFlow/Processor/DeliveryFeeFreeProcessorTest.php index f3f8f791f09..ce267215c13 100644 --- a/tests/Eccube/Tests/Service/PurchaseFlow/Processor/DeliveryFeeFreeProcessorTest.php +++ b/tests/Eccube/Tests/Service/PurchaseFlow/Processor/DeliveryFeeFreeProcessorTest.php @@ -15,6 +15,7 @@ use Eccube\Entity\BaseInfo; use Eccube\Entity\Order; +use Eccube\Repository\BaseInfoRepository; use Eccube\Service\PurchaseFlow\Processor\DeliveryFeeFreePreprocessor; use Eccube\Service\PurchaseFlow\PurchaseContext; use Eccube\Tests\EccubeTestCase; @@ -36,6 +37,10 @@ class DeliveryFeeFreeProcessorTest extends EccubeTestCase */ protected $BaseInfo; + /** @var BaseInfoRepository */ + protected $baseInfoRepository; + + /** * {@inheritdoc} */ @@ -44,7 +49,8 @@ public function setUp() parent::setUp(); $this->BaseInfo = $this->entityManager->find(BaseInfo::class, 1); - $this->processor = new DeliveryFeeFreePreprocessor($this->BaseInfo); + $this->baseInfoRepository = $this->container->get(BaseInfoRepository::class); + $this->processor = new DeliveryFeeFreePreprocessor($this->baseInfoRepository); $this->Order = $this->createOrder($this->createCustomer()); } diff --git a/tests/Eccube/Tests/Service/PurchaseFlow/Processor/PointDiffProcessorTest.php b/tests/Eccube/Tests/Service/PurchaseFlow/Processor/PointDiffProcessorTest.php index fefc1ba358f..5d9353bb364 100644 --- a/tests/Eccube/Tests/Service/PurchaseFlow/Processor/PointDiffProcessorTest.php +++ b/tests/Eccube/Tests/Service/PurchaseFlow/Processor/PointDiffProcessorTest.php @@ -46,7 +46,7 @@ public function setUp() $this->processor = $this->container->get(PointDiffProcessor::class); $this->pointProcessor = $this->container->get(PointProcessor::class); $this->OrderStatusRepository = $this->container->get(OrderStatusRepository::class); - $this->BaseInfo = $this->container->get(BaseInfo::class); + $this->BaseInfo = $this->entityManager->find(BaseInfo::class, 1); } /** diff --git a/tests/Eccube/Tests/Service/PurchaseFlow/Processor/PointProcessorTest.php b/tests/Eccube/Tests/Service/PurchaseFlow/Processor/PointProcessorTest.php index 374f2ddd2c7..8ca2d8a36a7 100644 --- a/tests/Eccube/Tests/Service/PurchaseFlow/Processor/PointProcessorTest.php +++ b/tests/Eccube/Tests/Service/PurchaseFlow/Processor/PointProcessorTest.php @@ -35,7 +35,7 @@ public function setUp() { parent::setUp(); $this->processor = $this->container->get(PointProcessor::class); - $this->BaseInfo = $this->container->get(BaseInfo::class); + $this->BaseInfo = $this->entityManager->find(BaseInfo::class, 1); } public function testUsePoint() diff --git a/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php b/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php index 0895e4070ac..d96193fac89 100644 --- a/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Order/EditControllerTest.php @@ -37,7 +37,7 @@ public function setUp() $this->customerRepository = $this->container->get(CustomerRepository::class); $this->orderRepository = $this->container->get(OrderRepository::class); $this->cartService = $this->container->get(CartService::class); - $BaseInfo = $this->container->get(BaseInfo::class); + $BaseInfo = $this->entityManager->find(BaseInfo::class, 1); $this->entityManager->flush($BaseInfo); } diff --git a/tests/Eccube/Tests/Web/Admin/Order/MailControllerTest.php b/tests/Eccube/Tests/Web/Admin/Order/MailControllerTest.php index 2ef896a7aa2..ff0e3bb8f1c 100644 --- a/tests/Eccube/Tests/Web/Admin/Order/MailControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Order/MailControllerTest.php @@ -108,7 +108,7 @@ public function testIndexWithComplete() /** @var \Swift_Message $Message */ $Message = $collectedMessages[0]; - $BaseInfo = $this->container->get(BaseInfo::class); + $BaseInfo = $this->entityManager->find(BaseInfo::class, 1); $this->expected = '['.$BaseInfo->getShopName().'] '.$form['mail_subject']; $this->actual = $Message->getSubject(); $this->verify(); @@ -169,7 +169,7 @@ public function testMailAllWithComplete() $Messages = $mailCollector->getMessages(); $Message = $Messages[0]; - $BaseInfo = $this->container->get(BaseInfo::class); + $BaseInfo = $this->entityManager->find(BaseInfo::class, 1); $this->expected = '['.$BaseInfo->getShopName().'] '.$form['mail_subject']; $this->actual = $Message->getSubject(); $this->verify(); diff --git a/tests/Eccube/Tests/Web/Admin/Product/ProductClassControllerTest.php b/tests/Eccube/Tests/Web/Admin/Product/ProductClassControllerTest.php index b28705d6afe..870ce9e0d30 100644 --- a/tests/Eccube/Tests/Web/Admin/Product/ProductClassControllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Product/ProductClassControllerTest.php @@ -53,7 +53,7 @@ public function setUp() { parent::setUp(); - $this->BaseInfo = $this->container->get(BaseInfo::class); + $this->BaseInfo = $this->entityManager->find(BaseInfo::class, 1); $this->productRepository = $this->container->get(ProductRepository::class); $this->taxRuleRepository = $this->container->get(TaxRuleRepository::class); $this->classCategoryRepository = $this->container->get(ClassCategoryRepository::class); diff --git a/tests/Eccube/Tests/Web/Admin/Product/ProductContorllerTest.php b/tests/Eccube/Tests/Web/Admin/Product/ProductContorllerTest.php index 9914cd527a0..6adf1d8fe9b 100644 --- a/tests/Eccube/Tests/Web/Admin/Product/ProductContorllerTest.php +++ b/tests/Eccube/Tests/Web/Admin/Product/ProductContorllerTest.php @@ -57,7 +57,7 @@ public function setUp() parent::setUp(); $this->productRepository = $this->container->get(ProductRepository::class); - $this->baseInfo = $this->container->get(BaseInfo::class); + $this->baseInfo = $this->entityManager->find(BaseInfo::class, 1); $this->taxRuleRepository = $this->container->get(TaxRuleRepository::class); $this->productStatusRepository = $this->container->get(ProductStatusRepository::class); diff --git a/tests/Eccube/Tests/Web/CartValidationTest.php b/tests/Eccube/Tests/Web/CartValidationTest.php index af488bc702f..b6431bfa74d 100644 --- a/tests/Eccube/Tests/Web/CartValidationTest.php +++ b/tests/Eccube/Tests/Web/CartValidationTest.php @@ -44,7 +44,7 @@ public function setUp() parent::setUp(); $this->productStatusRepository = $this->container->get(ProductStatusRepository::class); $this->cartService = $this->container->get(CartService::class); - $this->BaseInfo = $this->container->get(BaseInfo::class); + $this->BaseInfo = $this->entityManager->find(BaseInfo::class, 1); } /** diff --git a/tests/Eccube/Tests/Web/ShoppingControllerWithNonmemberTest.php b/tests/Eccube/Tests/Web/ShoppingControllerWithNonmemberTest.php index a70d13707b3..c3e5a57a168 100644 --- a/tests/Eccube/Tests/Web/ShoppingControllerWithNonmemberTest.php +++ b/tests/Eccube/Tests/Web/ShoppingControllerWithNonmemberTest.php @@ -28,7 +28,7 @@ class ShoppingControllerWithNonmemberTest extends AbstractShoppingControllerTest public function setUp() { parent::setUp(); - $this->BaseInfo = $this->container->get(BaseInfo::class); + $this->BaseInfo = $this->entityManager->find(BaseInfo::class, 1); } public function testRoutingShoppingLogin()