Skip to content

Commit

Permalink
BaseInfo をインジェクションしないよう修正
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Aug 3, 2018
1 parent 1495b99 commit 1892f3b
Show file tree
Hide file tree
Showing 35 changed files with 120 additions and 84 deletions.
2 changes: 0 additions & 2 deletions app/config/eccube/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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の後に登録するため,
Expand Down
7 changes: 4 additions & 3 deletions src/Eccube/Controller/Admin/Product/CsvImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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();
}

/**
Expand Down
11 changes: 6 additions & 5 deletions src/Eccube/Controller/Admin/Product/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -87,9 +88,9 @@ class ProductController extends AbstractController
protected $productRepository;

/**
* @var BaseInfo
* @var BaseInfoRepository
*/
protected $BaseInfo;
protected $baseInfoRepository;

/**
* @var PageMaxRepository
Expand All @@ -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
Expand All @@ -127,7 +128,7 @@ public function __construct(
TaxRuleRepository $taxRuleRepository,
CategoryRepository $categoryRepository,
ProductRepository $productRepository,
BaseInfo $BaseInfo,
BaseInfoRepository $baseInfoRepository,
PageMaxRepository $pageMaxRepository,
ProductStatusRepository $productStatusRepository,
TagRepository $tagRepository
Expand All @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions src/Eccube/Controller/Admin/Setting/Shop/ShopController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
7 changes: 4 additions & 3 deletions src/Eccube/Controller/Admin/Store/PluginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/Eccube/Controller/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/Eccube/Controller/EntryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -82,15 +83,15 @@ class EntryController extends AbstractController
public function __construct(
CustomerStatusRepository $customerStatusRepository,
MailService $mailService,
BaseInfo $BaseInfo,
BaseInfoRepository $baseInfoRepository,
CustomerRepository $customerRepository,
EncoderFactoryInterface $encoderFactory,
ValidatorInterface $validatorInterface,
TokenStorageInterface $tokenStorage
) {
$this->customerStatusRepository = $customerStatusRepository;
$this->mailService = $mailService;
$this->BaseInfo = $BaseInfo;
$this->BaseInfo = $baseInfoRepository->get();
$this->customerRepository = $customerRepository;
$this->encoderFactory = $encoderFactory;
$this->recursiveValidator = $validatorInterface;
Expand Down
5 changes: 3 additions & 2 deletions src/Eccube/Controller/Mypage/DeliveryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
7 changes: 4 additions & 3 deletions src/Eccube/Controller/Mypage/MypageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 4 additions & 3 deletions src/Eccube/Controller/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -77,22 +78,22 @@ 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(
PurchaseFlow $cartPurchaseFlow,
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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Eccube/Form/Type/Admin/OrderItemType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions src/Eccube/Form/Type/Admin/ShippingType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/Eccube/Repository/TaxRuleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
Loading

0 comments on commit 1892f3b

Please sign in to comment.