|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is part of EC-CUBE |
|
4
|
|
|
* |
|
5
|
|
|
* Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved. |
|
6
|
|
|
* |
|
7
|
|
|
* http://www.lockon.co.jp/ |
|
8
|
|
|
* |
|
9
|
|
|
* This program is free software; you can redistribute it and/or |
|
10
|
|
|
* modify it under the terms of the GNU General Public License |
|
11
|
|
|
* as published by the Free Software Foundation; either version 2 |
|
12
|
|
|
* of the License, or (at your option) any later version. |
|
13
|
|
|
* |
|
14
|
|
|
* This program is distributed in the hope that it will be useful, |
|
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17
|
|
|
* GNU General Public License for more details. |
|
18
|
|
|
* |
|
19
|
|
|
* You should have received a copy of the GNU General Public License |
|
20
|
|
|
* along with this program; if not, write to the Free Software |
|
21
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
namespace Eccube\ServiceProvider; |
|
26
|
|
|
|
|
27
|
|
|
use Eccube\Doctrine\EventSubscriber\TaxRuleEventSubscriber; |
|
28
|
|
|
use Eccube\Entity\BaseInfo; |
|
29
|
|
|
use Eccube\Repository\BaseInfoRepository; |
|
30
|
|
|
use Eccube\Service\TaxRuleService; |
|
31
|
|
|
use Pimple\Container; |
|
32
|
|
|
use Pimple\ServiceProviderInterface; |
|
33
|
|
|
use Silex\Api\EventListenerProviderInterface; |
|
34
|
|
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
|
35
|
|
|
use Symfony\Component\HttpFoundation\ParameterBag; |
|
36
|
|
|
|
|
37
|
|
|
class EccubeServiceProvider implements ServiceProviderInterface, EventListenerProviderInterface |
|
|
|
|
|
|
38
|
|
|
{ |
|
39
|
|
|
/** |
|
40
|
|
|
* Registers services on the given app. |
|
41
|
|
|
* |
|
42
|
|
|
* This method should only be used to configure services and parameters. |
|
43
|
|
|
* It should not get services. |
|
44
|
|
|
* |
|
45
|
|
|
* @param BaseApplication $app An Application instance |
|
46
|
|
|
*/ |
|
47
|
|
|
public function register(Container $app) |
|
48
|
|
|
{ |
|
49
|
|
|
$app[BaseInfo::class] = function () use ($app) { |
|
50
|
|
|
return $app[BaseInfoRepository::class]->get(); |
|
51
|
|
|
}; |
|
52
|
|
|
|
|
53
|
|
|
$app['request_scope'] = function () { |
|
54
|
|
|
return new ParameterBag(); |
|
55
|
|
|
}; |
|
56
|
|
|
|
|
57
|
|
|
// Application::initRenderingと一緒に修正 |
|
58
|
|
|
$app['eccube.twig.block.templates'] = function () { |
|
59
|
|
|
$templates = new ArrayCollection(); |
|
60
|
|
|
$templates[] = 'render_block.twig'; |
|
61
|
|
|
|
|
62
|
|
|
return $templates; |
|
63
|
|
|
}; |
|
64
|
1069 |
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function subscribe(Container $app, EventDispatcherInterface $dispatcher) |
|
|
|
|
|
|
67
|
356 |
|
{ |
|
68
|
|
|
// Add event subscriber to TaxRuleEvent |
|
69
|
|
|
// initDoctrineのタイミングでは、TaxRuleServiceが定義されていないため, ここで追加. |
|
70
|
|
|
$app['orm.em']->getEventManager()->addEventSubscriber(new TaxRuleEventSubscriber($app[TaxRuleService::class])); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|