@@ -959,7 +959,7 @@ |
||
| 959 | 959 | * 失敗 : \Doctrine\DBAL\DBALExceptionエラーが発生( 接続に失敗した場合 )、エラー画面を表示しdie() |
| 960 | 960 | * 備考 : app['debug']がtrueの際は処理を行わない |
| 961 | 961 | * |
| 962 | - * @return boolean true |
|
| 962 | + * @return null|boolean true |
|
| 963 | 963 | * |
| 964 | 964 | */ |
| 965 | 965 | protected function checkDatabaseConnection() |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $this->register(new \Eccube\ServiceProvider\ValidatorServiceProvider()); |
| 137 | 137 | |
| 138 | 138 | $app = $this; |
| 139 | - $this->error(function (\Exception $e, $code) use ($app) { |
|
| 139 | + $this->error(function(\Exception $e, $code) use ($app) { |
|
| 140 | 140 | if ($app['debug']) { |
| 141 | 141 | return; |
| 142 | 142 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $this->register(new \Silex\Provider\TranslationServiceProvider(), array( |
| 204 | 204 | 'locale' => $this['config']['locale'], |
| 205 | 205 | )); |
| 206 | - $this['translator'] = $this->share($this->extend('translator', function ($translator, \Silex\Application $app) { |
|
| 206 | + $this['translator'] = $this->share($this->extend('translator', function($translator, \Silex\Application $app) { |
|
| 207 | 207 | $translator->addLoader('yaml', new \Symfony\Component\Translation\Loader\YamlFileLoader()); |
| 208 | 208 | |
| 209 | 209 | $r = new \ReflectionClass('Symfony\Component\Validator\Validator'); |
@@ -256,16 +256,16 @@ discard block |
||
| 256 | 256 | $this->register(new \Silex\Provider\TwigServiceProvider(), array( |
| 257 | 257 | 'twig.form.templates' => array('Form/form_layout.twig'), |
| 258 | 258 | )); |
| 259 | - $this['twig'] = $this->share($this->extend('twig', function (\Twig_Environment $twig, \Silex\Application $app) { |
|
| 259 | + $this['twig'] = $this->share($this->extend('twig', function(\Twig_Environment $twig, \Silex\Application $app) { |
|
| 260 | 260 | $twig->addExtension(new \Eccube\Twig\Extension\EccubeExtension($app)); |
| 261 | 261 | $twig->addExtension(new \Twig_Extension_StringLoader()); |
| 262 | 262 | |
| 263 | 263 | return $twig; |
| 264 | 264 | })); |
| 265 | 265 | |
| 266 | - $this->before(function (Request $request, \Silex\Application $app) { |
|
| 266 | + $this->before(function(Request $request, \Silex\Application $app) { |
|
| 267 | 267 | // フロント or 管理画面ごとにtwigの探索パスを切り替える. |
| 268 | - $app['twig'] = $app->share($app->extend('twig', function (\Twig_Environment $twig, \Silex\Application $app) { |
|
| 268 | + $app['twig'] = $app->share($app->extend('twig', function(\Twig_Environment $twig, \Silex\Application $app) { |
|
| 269 | 269 | $paths = array(); |
| 270 | 270 | |
| 271 | 271 | // 互換性がないのでprofiler とproduction 時のcacheを分離する |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | // twigのグローバル変数を定義. |
| 319 | 319 | $app = $this; |
| 320 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function (\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) use ($app) { |
|
| 320 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function(\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) use ($app) { |
|
| 321 | 321 | // ショップ基本情報 |
| 322 | 322 | $BaseInfo = $app['eccube.repository.base_info']->get(); |
| 323 | 323 | $app['twig']->addGlobal('BaseInfo', $BaseInfo); |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | // メール送信時の文字エンコード指定(デフォルトはUTF-8) |
| 378 | 378 | if (isset($this['config']['mail']['charset_iso_2022_jp']) && is_bool($this['config']['mail']['charset_iso_2022_jp'])) { |
| 379 | 379 | if ($this['config']['mail']['charset_iso_2022_jp'] === true) { |
| 380 | - \Swift::init(function () { |
|
| 380 | + \Swift::init(function() { |
|
| 381 | 381 | \Swift_DependencyContainer::getInstance() |
| 382 | 382 | ->register('mime.qpheaderencoder') |
| 383 | 383 | ->asAliasOf('mime.base64headerencoder'); |
@@ -563,19 +563,19 @@ discard block |
||
| 563 | 563 | array('^/mypage', 'ROLE_USER'), |
| 564 | 564 | ); |
| 565 | 565 | |
| 566 | - $this['eccube.password_encoder'] = $this->share(function ($app) { |
|
| 566 | + $this['eccube.password_encoder'] = $this->share(function($app) { |
|
| 567 | 567 | return new \Eccube\Security\Core\Encoder\PasswordEncoder($app['config']); |
| 568 | 568 | }); |
| 569 | - $this['security.encoder_factory'] = $this->share(function ($app) { |
|
| 569 | + $this['security.encoder_factory'] = $this->share(function($app) { |
|
| 570 | 570 | return new \Symfony\Component\Security\Core\Encoder\EncoderFactory(array( |
| 571 | 571 | 'Eccube\Entity\Customer' => $app['eccube.password_encoder'], |
| 572 | 572 | 'Eccube\Entity\Member' => $app['eccube.password_encoder'], |
| 573 | 573 | )); |
| 574 | 574 | }); |
| 575 | - $this['eccube.event_listner.security'] = $this->share(function ($app) { |
|
| 575 | + $this['eccube.event_listner.security'] = $this->share(function($app) { |
|
| 576 | 576 | return new \Eccube\EventListener\SecurityEventListener($app['orm.em']); |
| 577 | 577 | }); |
| 578 | - $this['user'] = function ($app) { |
|
| 578 | + $this['user'] = function($app) { |
|
| 579 | 579 | $token = $app['security']->getToken(); |
| 580 | 580 | |
| 581 | 581 | return ($token !== null) ? $token->getUser() : null; |
@@ -586,17 +586,17 @@ discard block |
||
| 586 | 586 | |
| 587 | 587 | // Voterの設定 |
| 588 | 588 | $app = $this; |
| 589 | - $this['authority_voter'] = $this->share(function ($app) { |
|
| 589 | + $this['authority_voter'] = $this->share(function($app) { |
|
| 590 | 590 | return new \Eccube\Security\Voter\AuthorityVoter($app); |
| 591 | 591 | }); |
| 592 | 592 | |
| 593 | - $app['security.voters'] = $app->extend('security.voters', function ($voters) use ($app) { |
|
| 593 | + $app['security.voters'] = $app->extend('security.voters', function($voters) use ($app) { |
|
| 594 | 594 | $voters[] = $app['authority_voter']; |
| 595 | 595 | |
| 596 | 596 | return $voters; |
| 597 | 597 | }); |
| 598 | 598 | |
| 599 | - $this['security.access_manager'] = $this->share(function ($app) { |
|
| 599 | + $this['security.access_manager'] = $this->share(function($app) { |
|
| 600 | 600 | return new \Symfony\Component\Security\Core\Authorization\AccessDecisionManager($app['security.voters'], 'unanimous'); |
| 601 | 601 | }); |
| 602 | 602 | |
@@ -620,14 +620,14 @@ discard block |
||
| 620 | 620 | public function initPluginEventDispatcher() |
| 621 | 621 | { |
| 622 | 622 | // EventDispatcher |
| 623 | - $this['eccube.event.dispatcher'] = $this->share(function () { |
|
| 623 | + $this['eccube.event.dispatcher'] = $this->share(function() { |
|
| 624 | 624 | return new EventDispatcher(); |
| 625 | 625 | }); |
| 626 | 626 | |
| 627 | 627 | $app = $this; |
| 628 | 628 | |
| 629 | 629 | // hook point |
| 630 | - $this->on(KernelEvents::REQUEST, function (GetResponseEvent $event) use ($app) { |
|
| 630 | + $this->on(KernelEvents::REQUEST, function(GetResponseEvent $event) use ($app) { |
|
| 631 | 631 | if (!$event->isMasterRequest()) { |
| 632 | 632 | return; |
| 633 | 633 | } |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | $app['eccube.event.dispatcher']->dispatch($hookpoint, $event); |
| 636 | 636 | }, self::EARLY_EVENT); |
| 637 | 637 | |
| 638 | - $this->on(KernelEvents::REQUEST, function (GetResponseEvent $event) use ($app) { |
|
| 638 | + $this->on(KernelEvents::REQUEST, function(GetResponseEvent $event) use ($app) { |
|
| 639 | 639 | if (!$event->isMasterRequest()) { |
| 640 | 640 | return; |
| 641 | 641 | } |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | $app['eccube.event.dispatcher']->dispatch($hookpoint, $event); |
| 645 | 645 | }); |
| 646 | 646 | |
| 647 | - $this->on(KernelEvents::RESPONSE, function (FilterResponseEvent $event) use ($app) { |
|
| 647 | + $this->on(KernelEvents::RESPONSE, function(FilterResponseEvent $event) use ($app) { |
|
| 648 | 648 | if (!$event->isMasterRequest()) { |
| 649 | 649 | return; |
| 650 | 650 | } |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | $app['eccube.event.dispatcher']->dispatch($hookpoint, $event); |
| 654 | 654 | }); |
| 655 | 655 | |
| 656 | - $this->on(KernelEvents::RESPONSE, function (FilterResponseEvent $event) use ($app) { |
|
| 656 | + $this->on(KernelEvents::RESPONSE, function(FilterResponseEvent $event) use ($app) { |
|
| 657 | 657 | if (!$event->isMasterRequest()) { |
| 658 | 658 | return; |
| 659 | 659 | } |
@@ -661,19 +661,19 @@ discard block |
||
| 661 | 661 | $app['eccube.event.dispatcher']->dispatch($hookpoint, $event); |
| 662 | 662 | }, self::LATE_EVENT); |
| 663 | 663 | |
| 664 | - $this->on(KernelEvents::TERMINATE, function (PostResponseEvent $event) use ($app) { |
|
| 664 | + $this->on(KernelEvents::TERMINATE, function(PostResponseEvent $event) use ($app) { |
|
| 665 | 665 | $route = $event->getRequest()->attributes->get('_route'); |
| 666 | 666 | $hookpoint = "eccube.event.controller.$route.finish"; |
| 667 | 667 | $app['eccube.event.dispatcher']->dispatch($hookpoint, $event); |
| 668 | 668 | }); |
| 669 | 669 | |
| 670 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
| 670 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function(\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
| 671 | 671 | $route = $event->getRequest()->attributes->get('_route'); |
| 672 | 672 | $app['eccube.event.dispatcher']->dispatch('eccube.event.render.'.$route.'.before', $event); |
| 673 | 673 | }); |
| 674 | 674 | |
| 675 | 675 | // Request Event |
| 676 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::REQUEST, function (\Symfony\Component\HttpKernel\Event\GetResponseEvent $event) use ($app) { |
|
| 676 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::REQUEST, function(\Symfony\Component\HttpKernel\Event\GetResponseEvent $event) use ($app) { |
|
| 677 | 677 | |
| 678 | 678 | if (\Symfony\Component\HttpKernel\HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { |
| 679 | 679 | return; |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | }, 30); // Routing(32)が解決しし, 認証判定(8)が実行される前のタイミング. |
| 705 | 705 | |
| 706 | 706 | // Controller Event |
| 707 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function (\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) use ($app) { |
|
| 707 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function(\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) use ($app) { |
|
| 708 | 708 | |
| 709 | 709 | if (\Symfony\Component\HttpKernel\HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { |
| 710 | 710 | return; |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | }); |
| 736 | 736 | |
| 737 | 737 | // Response Event |
| 738 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
| 738 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function(\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
| 739 | 739 | |
| 740 | 740 | if (\Symfony\Component\HttpKernel\HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { |
| 741 | 741 | return; |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | }); |
| 766 | 766 | |
| 767 | 767 | // Exception Event |
| 768 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::EXCEPTION, function (\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event) use ($app) { |
|
| 768 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::EXCEPTION, function(\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event) use ($app) { |
|
| 769 | 769 | |
| 770 | 770 | if (\Symfony\Component\HttpKernel\HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { |
| 771 | 771 | return; |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | }); |
| 796 | 796 | |
| 797 | 797 | // Terminate Event |
| 798 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::TERMINATE, function (\Symfony\Component\HttpKernel\Event\PostResponseEvent $event) use ($app) { |
|
| 798 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::TERMINATE, function(\Symfony\Component\HttpKernel\Event\PostResponseEvent $event) use ($app) { |
|
| 799 | 799 | |
| 800 | 800 | $route = $event->getRequest()->attributes->get('_route'); |
| 801 | 801 | |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | |
| 872 | 872 | // const |
| 873 | 873 | if (isset($config['const'])) { |
| 874 | - $this['config'] = $this->share($this->extend('config', function ($eccubeConfig) use ($config) { |
|
| 874 | + $this['config'] = $this->share($this->extend('config', function($eccubeConfig) use ($config) { |
|
| 875 | 875 | $eccubeConfig[$config['code']] = array( |
| 876 | 876 | 'const' => $config['const'], |
| 877 | 877 | ); |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | $app = $this; |
| 1075 | 1075 | |
| 1076 | 1076 | // Response Event(http cache対応、event実行は一番遅く設定) |
| 1077 | - $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
| 1077 | + $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function(\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) { |
|
| 1078 | 1078 | |
| 1079 | 1079 | $request = $event->getRequest(); |
| 1080 | 1080 | $response = $event->getResponse(); |
@@ -52,11 +52,17 @@ |
||
| 52 | 52 | return $form; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | + /** |
|
| 56 | + * @param Application $app |
|
| 57 | + */ |
|
| 55 | 58 | protected function getSecurity($app) |
| 56 | 59 | { |
| 57 | 60 | return $app['security.token_storage']; |
| 58 | 61 | } |
| 59 | 62 | |
| 63 | + /** |
|
| 64 | + * @param Application $app |
|
| 65 | + */ |
|
| 60 | 66 | protected function isTokenValid($app) |
| 61 | 67 | { |
| 62 | 68 | $csrf = $app['form.csrf_provider']; |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | @trigger_error('The '.__METHOD__.' method is deprecated.', E_USER_DEPRECATED); |
| 46 | 46 | |
| 47 | 47 | $form = $app['form.factory'] |
| 48 | - ->createBuilder($app['eccube.form.type.' . $type], $app['eccube.entity.' . $type]) |
|
| 48 | + ->createBuilder($app['eccube.form.type.'.$type], $app['eccube.entity.'.$type]) |
|
| 49 | 49 | ->getForm(); |
| 50 | 50 | $form->handleRequest($app['request']); |
| 51 | 51 | |
@@ -230,6 +230,10 @@ discard block |
||
| 230 | 230 | return $str; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | + /** |
|
| 234 | + * @param string $topDir |
|
| 235 | + * @param Request $request |
|
| 236 | + */ |
|
| 233 | 237 | private function getTree($topDir, $request) |
| 234 | 238 | { |
| 235 | 239 | $finder = Finder::create()->in($topDir) |
@@ -267,6 +271,10 @@ discard block |
||
| 267 | 271 | return $tree; |
| 268 | 272 | } |
| 269 | 273 | |
| 274 | + /** |
|
| 275 | + * @param Application $app |
|
| 276 | + * @param string $nowDir |
|
| 277 | + */ |
|
| 270 | 278 | private function getFileList($app, $nowDir) |
| 271 | 279 | { |
| 272 | 280 | $topDir = $app['config']['user_data_realdir']; |
@@ -326,6 +334,9 @@ discard block |
||
| 326 | 334 | return (strpos($targetDir, $topDir) === 0); |
| 327 | 335 | } |
| 328 | 336 | |
| 337 | + /** |
|
| 338 | + * @return string |
|
| 339 | + */ |
|
| 329 | 340 | private function convertStrFromServer($target) |
| 330 | 341 | { |
| 331 | 342 | if ($this->encode == self::SJIS) { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | private $error = null; |
| 40 | 40 | private $encode = ''; |
| 41 | 41 | |
| 42 | - public function __construct(){ |
|
| 42 | + public function __construct() { |
|
| 43 | 43 | $this->encode = self::UTF; |
| 44 | 44 | if ('\\' === DIRECTORY_SEPARATOR) { |
| 45 | 45 | $this->encode = self::SJIS; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $arrFileList = $this->getFileList($app, $nowDir); |
| 83 | 83 | |
| 84 | 84 | $javascript = $this->getJsArrayList($tree); |
| 85 | - $onload = "eccube.fileManager.viewFileTree('tree', arrTree, '" . $nowDir . "', 'tree_select_file', 'tree_status', 'move');"; |
|
| 85 | + $onload = "eccube.fileManager.viewFileTree('tree', arrTree, '".$nowDir."', 'tree_select_file', 'tree_status', 'move');"; |
|
| 86 | 86 | |
| 87 | 87 | return $app->render('Content/file.twig', array( |
| 88 | 88 | 'form' => $form->createView(), |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $nowDir = $this->checkDir($request->get('now_dir'), $topDir) |
| 140 | 140 | ? $this->normalizePath($request->get('now_dir')) |
| 141 | 141 | : $topDir; |
| 142 | - $fs->mkdir($nowDir . '/' . $filename); |
|
| 142 | + $fs->mkdir($nowDir.'/'.$filename); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | { |
| 220 | 220 | $str = "arrTree = new Array();\n"; |
| 221 | 221 | foreach ($tree as $key => $val) { |
| 222 | - $str .= 'arrTree[' . $key . "] = new Array(" . $key . ", '" . $val['type'] . "', '" . $val['path'] . "', " . $val['rank'] . ','; |
|
| 222 | + $str .= 'arrTree['.$key."] = new Array(".$key.", '".$val['type']."', '".$val['path']."', ".$val['rank'].','; |
|
| 223 | 223 | if ($val['open']) { |
| 224 | 224 | $str .= "true);\n"; |
| 225 | 225 | } else { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | private function getFileList($app, $nowDir) |
| 271 | 271 | { |
| 272 | 272 | $topDir = $app['config']['user_data_realdir']; |
| 273 | - $filter = function (\SplFileInfo $file) use ($topDir) { |
|
| 273 | + $filter = function(\SplFileInfo $file) use ($topDir) { |
|
| 274 | 274 | $acceptPath = realpath($topDir); |
| 275 | 275 | $targetPath = $file->getRealPath(); |
| 276 | 276 | return (strpos($targetPath, $acceptPath) === 0); |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | /** |
| 524 | 524 | * フォームからの入直内容に基づいて、受注情報の再計算を行う |
| 525 | 525 | * |
| 526 | - * @param $app |
|
| 526 | + * @param Application $app |
|
| 527 | 527 | * @param $Order |
| 528 | 528 | */ |
| 529 | 529 | protected function calculate($app, \Eccube\Entity\Order $Order) |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | * - 受注ステータスが入金済に設定された場合に入金日を更新 |
| 614 | 614 | * |
| 615 | 615 | * |
| 616 | - * @param $app |
|
| 616 | + * @param Application $app |
|
| 617 | 617 | * @param $TargetOrder |
| 618 | 618 | * @param $OriginOrder |
| 619 | 619 | */ |
@@ -446,7 +446,7 @@ |
||
| 446 | 446 | $session->set('eccube.admin.order.product.search', $searchData); |
| 447 | 447 | $session->set('eccube.admin.order.product.search.page_no', $page_no); |
| 448 | 448 | } else { |
| 449 | - $searchData = (array)$session->get('eccube.admin.order.product.search'); |
|
| 449 | + $searchData = (array) $session->get('eccube.admin.order.product.search'); |
|
| 450 | 450 | if (is_null($page_no)) { |
| 451 | 451 | $page_no = intval($session->get('eccube.admin.order.product.search.page_no')); |
| 452 | 452 | } else { |
@@ -354,6 +354,9 @@ |
||
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | |
| 357 | + /** |
|
| 358 | + * @param Application $app |
|
| 359 | + */ |
|
| 357 | 360 | private function createBody($app, $header, $footer, $Order) |
| 358 | 361 | { |
| 359 | 362 | return $app->renderView('Mail/order.twig', array( |
@@ -336,10 +336,10 @@ |
||
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | } else { |
| 339 | - $filter = function ($v) { |
|
| 339 | + $filter = function($v) { |
|
| 340 | 340 | return preg_match('/^ids\d+$/', $v); |
| 341 | 341 | }; |
| 342 | - $map = function ($v) { |
|
| 342 | + $map = function($v) { |
|
| 343 | 343 | return preg_replace('/[^\d+]/', '', $v); |
| 344 | 344 | }; |
| 345 | 345 | $keys = array_keys($request->query->all()); |
@@ -582,6 +582,8 @@ discard block |
||
| 582 | 582 | /** |
| 583 | 583 | * 登録、更新時のエラー画面表示 |
| 584 | 584 | * |
| 585 | + * @param Application $app |
|
| 586 | + * @param string $twig |
|
| 585 | 587 | */ |
| 586 | 588 | protected function render($app, $form, $headers, $twig) |
| 587 | 589 | { |
@@ -613,6 +615,7 @@ discard block |
||
| 613 | 615 | * アップロードされたCSVファイルの行ごとの処理 |
| 614 | 616 | * |
| 615 | 617 | * @param $formFile |
| 618 | + * @param Application $app |
|
| 616 | 619 | * @return CsvImportService |
| 617 | 620 | */ |
| 618 | 621 | protected function getImportData($app, $formFile) |
@@ -690,6 +693,8 @@ discard block |
||
| 690 | 693 | |
| 691 | 694 | /** |
| 692 | 695 | * 商品カテゴリの削除、登録 |
| 696 | + * @param Application $app |
|
| 697 | + * @param CsvImportService $data |
|
| 693 | 698 | */ |
| 694 | 699 | protected function createProductCategory($row, Product $Product, $app, $data) |
| 695 | 700 | { |
@@ -781,6 +786,8 @@ discard block |
||
| 781 | 786 | |
| 782 | 787 | /** |
| 783 | 788 | * 商品規格分類1、商品規格分類2がnullとなる商品規格情報を作成 |
| 789 | + * @param Application $app |
|
| 790 | + * @param CsvImportService $data |
|
| 784 | 791 | */ |
| 785 | 792 | protected function createProductClass($row, Product $Product, $app, $data, $ClassCategory1 = null, $ClassCategory2 = null) |
| 786 | 793 | { |
@@ -922,6 +929,8 @@ discard block |
||
| 922 | 929 | |
| 923 | 930 | /** |
| 924 | 931 | * 商品規格情報を更新 |
| 932 | + * @param Application $app |
|
| 933 | + * @param CsvImportService $data |
|
| 925 | 934 | */ |
| 926 | 935 | protected function updateProductClass($row, Product $Product, ProductClass $ProductClass, $app, $data) |
| 927 | 936 | { |
@@ -1068,6 +1077,7 @@ discard block |
||
| 1068 | 1077 | /** |
| 1069 | 1078 | * 登録、更新時のエラー画面表示 |
| 1070 | 1079 | * |
| 1080 | + * @param string $message |
|
| 1071 | 1081 | */ |
| 1072 | 1082 | protected function addErrors($message) |
| 1073 | 1083 | { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | foreach ($data as $row) { |
| 107 | 107 | |
| 108 | 108 | if ($headerSize != count($row)) { |
| 109 | - $this->addErrors(($data->key() + 1) . '行目のCSVフォーマットが一致しません。'); |
|
| 109 | + $this->addErrors(($data->key() + 1).'行目のCSVフォーマットが一致しません。'); |
|
| 110 | 110 | return $this->render($app, $form, $headers, $this->productTwig); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -117,33 +117,33 @@ discard block |
||
| 117 | 117 | if (preg_match('/^\d+$/', $row['商品ID'])) { |
| 118 | 118 | $Product = $app['eccube.repository.product']->find($row['商品ID']); |
| 119 | 119 | if (!$Product) { |
| 120 | - $this->addErrors(($data->key() + 1) . '行目の商品IDが存在しません。'); |
|
| 120 | + $this->addErrors(($data->key() + 1).'行目の商品IDが存在しません。'); |
|
| 121 | 121 | return $this->render($app, $form, $headers, $this->productTwig); |
| 122 | 122 | } |
| 123 | 123 | } else { |
| 124 | - $this->addErrors(($data->key() + 1) . '行目の商品IDが存在しません。'); |
|
| 124 | + $this->addErrors(($data->key() + 1).'行目の商品IDが存在しません。'); |
|
| 125 | 125 | return $this->render($app, $form, $headers, $this->productTwig); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if ($row['公開ステータス(ID)'] == '') { |
| 131 | - $this->addErrors(($data->key() + 1) . '行目の公開ステータス(ID)が設定されていません。'); |
|
| 131 | + $this->addErrors(($data->key() + 1).'行目の公開ステータス(ID)が設定されていません。'); |
|
| 132 | 132 | } else { |
| 133 | 133 | if (preg_match('/^\d+$/', $row['公開ステータス(ID)'])) { |
| 134 | 134 | $Disp = $app['eccube.repository.master.disp']->find($row['公開ステータス(ID)']); |
| 135 | 135 | if (!$Disp) { |
| 136 | - $this->addErrors(($data->key() + 1) . '行目の公開ステータス(ID)が存在しません。'); |
|
| 136 | + $this->addErrors(($data->key() + 1).'行目の公開ステータス(ID)が存在しません。'); |
|
| 137 | 137 | } else { |
| 138 | 138 | $Product->setStatus($Disp); |
| 139 | 139 | } |
| 140 | 140 | } else { |
| 141 | - $this->addErrors(($data->key() + 1) . '行目の公開ステータス(ID)が存在しません。'); |
|
| 141 | + $this->addErrors(($data->key() + 1).'行目の公開ステータス(ID)が存在しません。'); |
|
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if (Str::isBlank($row['商品名'])) { |
| 146 | - $this->addErrors(($data->key() + 1) . '行目の商品名が設定されていません。'); |
|
| 146 | + $this->addErrors(($data->key() + 1).'行目の商品名が設定されていません。'); |
|
| 147 | 147 | return $this->render($app, $form, $headers, $this->productTwig); |
| 148 | 148 | } else { |
| 149 | 149 | $Product->setName(Str::trimAll($row['商品名'])); |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | if ($row['商品削除フラグ'] == '') { |
| 183 | 183 | $Product->setDelFlg(Constant::DISABLED); |
| 184 | 184 | } else { |
| 185 | - if ($row['商品削除フラグ'] == (string)Constant::DISABLED || $row['商品削除フラグ'] == (string)Constant::ENABLED) { |
|
| 185 | + if ($row['商品削除フラグ'] == (string) Constant::DISABLED || $row['商品削除フラグ'] == (string) Constant::ENABLED) { |
|
| 186 | 186 | $Product->setDelFlg($row['商品削除フラグ']); |
| 187 | 187 | } else { |
| 188 | - $this->addErrors(($data->key() + 1) . '行目の商品削除フラグが設定されていません。'); |
|
| 188 | + $this->addErrors(($data->key() + 1).'行目の商品削除フラグが設定されていません。'); |
|
| 189 | 189 | return $this->render($app, $form, $headers, $this->productTwig); |
| 190 | 190 | } |
| 191 | 191 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | if (preg_match('/^\d+$/', $deliveryFee) && $deliveryFee >= 0) { |
| 213 | 213 | $ProductClassOrg->setDeliveryFee($deliveryFee); |
| 214 | 214 | } else { |
| 215 | - $this->addErrors(($data->key() + 1) . '行目の送料は0以上の数値を設定してください。'); |
|
| 215 | + $this->addErrors(($data->key() + 1).'行目の送料は0以上の数値を設定してください。'); |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | if ($row['規格分類1(ID)'] != '') { |
| 221 | 221 | |
| 222 | 222 | if ($row['規格分類1(ID)'] == $row['規格分類2(ID)']) { |
| 223 | - $this->addErrors(($data->key() + 1) . '行目の規格分類1(ID)と規格分類2(ID)には同じ値を使用できません。'); |
|
| 223 | + $this->addErrors(($data->key() + 1).'行目の規格分類1(ID)と規格分類2(ID)には同じ値を使用できません。'); |
|
| 224 | 224 | } else { |
| 225 | 225 | // 商品規格あり |
| 226 | 226 | // 企画分類あり商品を作成 |
@@ -235,30 +235,30 @@ discard block |
||
| 235 | 235 | if (preg_match('/^\d+$/', $row['規格分類1(ID)'])) { |
| 236 | 236 | $ClassCategory1 = $app['eccube.repository.class_category']->find($row['規格分類1(ID)']); |
| 237 | 237 | if (!$ClassCategory1) { |
| 238 | - $this->addErrors(($data->key() + 1) . '行目の規格分類1(ID)が存在しません。'); |
|
| 238 | + $this->addErrors(($data->key() + 1).'行目の規格分類1(ID)が存在しません。'); |
|
| 239 | 239 | } else { |
| 240 | 240 | $ProductClass->setClassCategory1($ClassCategory1); |
| 241 | 241 | } |
| 242 | 242 | } else { |
| 243 | - $this->addErrors(($data->key() + 1) . '行目の規格分類1(ID)が存在しません。'); |
|
| 243 | + $this->addErrors(($data->key() + 1).'行目の規格分類1(ID)が存在しません。'); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | if ($row['規格分類2(ID)'] != '') { |
| 247 | 247 | if (preg_match('/^\d+$/', $row['規格分類2(ID)'])) { |
| 248 | 248 | $ClassCategory2 = $app['eccube.repository.class_category']->find($row['規格分類2(ID)']); |
| 249 | 249 | if (!$ClassCategory2) { |
| 250 | - $this->addErrors(($data->key() + 1) . '行目の規格分類2(ID)が存在しません。'); |
|
| 250 | + $this->addErrors(($data->key() + 1).'行目の規格分類2(ID)が存在しません。'); |
|
| 251 | 251 | } else { |
| 252 | 252 | if ($ClassCategory1 && |
| 253 | 253 | ($ClassCategory1->getClassName()->getId() == $ClassCategory2->getClassName()->getId()) |
| 254 | 254 | ) { |
| 255 | - $this->addErrors(($data->key() + 1) . '行目の規格分類1(ID)と規格分類2(ID)の規格名が同じです。'); |
|
| 255 | + $this->addErrors(($data->key() + 1).'行目の規格分類1(ID)と規格分類2(ID)の規格名が同じです。'); |
|
| 256 | 256 | } else { |
| 257 | 257 | $ProductClass->setClassCategory2($ClassCategory2); |
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | } else { |
| 261 | - $this->addErrors(($data->key() + 1) . '行目の規格分類2(ID)が存在しません。'); |
|
| 261 | + $this->addErrors(($data->key() + 1).'行目の規格分類2(ID)が存在しません。'); |
|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | $ProductClass->setProductStock($ProductStock); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | } else { |
| 272 | 272 | if ($row['規格分類2(ID)'] != '') { |
| 273 | - $this->addErrors(($data->key() + 1) . '行目の規格分類1(ID)が存在しません。'); |
|
| 273 | + $this->addErrors(($data->key() + 1).'行目の規格分類1(ID)が存在しません。'); |
|
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | if (preg_match('/^\d+$/', $deliveryFee) && $deliveryFee >= 0) { |
| 299 | 299 | $pc->setDeliveryFee($deliveryFee); |
| 300 | 300 | } else { |
| 301 | - $this->addErrors(($data->key() + 1) . '行目の送料は0以上の数値を設定してください。'); |
|
| 301 | + $this->addErrors(($data->key() + 1).'行目の送料は0以上の数値を設定してください。'); |
|
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | if ($row['規格分類1(ID)'] == $row['規格分類2(ID)']) { |
| 323 | - $this->addErrors(($data->key() + 1) . '行目の規格分類1(ID)と規格分類2(ID)には同じ値を使用できません。'); |
|
| 323 | + $this->addErrors(($data->key() + 1).'行目の規格分類1(ID)と規格分類2(ID)には同じ値を使用できません。'); |
|
| 324 | 324 | } else { |
| 325 | 325 | |
| 326 | 326 | // 必ず規格分類1がセットされている |
@@ -329,36 +329,36 @@ discard block |
||
| 329 | 329 | if (preg_match('/^\d+$/', $classCategoryId1)) { |
| 330 | 330 | $ClassCategory1 = $app['eccube.repository.class_category']->find($classCategoryId1); |
| 331 | 331 | if (!$ClassCategory1) { |
| 332 | - $this->addErrors(($data->key() + 1) . '行目の規格分類1(ID)が存在しません。'); |
|
| 332 | + $this->addErrors(($data->key() + 1).'行目の規格分類1(ID)が存在しません。'); |
|
| 333 | 333 | } |
| 334 | 334 | } else { |
| 335 | - $this->addErrors(($data->key() + 1) . '行目の規格分類1(ID)が存在しません。'); |
|
| 335 | + $this->addErrors(($data->key() + 1).'行目の規格分類1(ID)が存在しません。'); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | $ClassCategory2 = null; |
| 339 | 339 | if ($row['規格分類2(ID)'] != '') { |
| 340 | 340 | if ($pc->getClassCategory1() != null && $pc->getClassCategory2() == null) { |
| 341 | - $this->addErrors(($data->key() + 1) . '行目の規格分類2(ID)は設定できません。'); |
|
| 341 | + $this->addErrors(($data->key() + 1).'行目の規格分類2(ID)は設定できません。'); |
|
| 342 | 342 | } else { |
| 343 | 343 | if (preg_match('/^\d+$/', $classCategoryId2)) { |
| 344 | 344 | $ClassCategory2 = $app['eccube.repository.class_category']->find($classCategoryId2); |
| 345 | 345 | if (!$ClassCategory2) { |
| 346 | - $this->addErrors(($data->key() + 1) . '行目の規格分類2(ID)が存在しません。'); |
|
| 346 | + $this->addErrors(($data->key() + 1).'行目の規格分類2(ID)が存在しません。'); |
|
| 347 | 347 | } else { |
| 348 | 348 | if ($ClassCategory1 && |
| 349 | 349 | ($ClassCategory1->getClassName()->getId() == $ClassCategory2->getClassName()->getId()) |
| 350 | 350 | ) { |
| 351 | - $this->addErrors(($data->key() + 1) . '行目の規格分類1(ID)と規格分類2(ID)の規格名が同じです。'); |
|
| 351 | + $this->addErrors(($data->key() + 1).'行目の規格分類1(ID)と規格分類2(ID)の規格名が同じです。'); |
|
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | } else { |
| 355 | - $this->addErrors(($data->key() + 1) . '行目の規格分類2(ID)が存在しません。'); |
|
| 355 | + $this->addErrors(($data->key() + 1).'行目の規格分類2(ID)が存在しません。'); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | } |
| 359 | 359 | } else { |
| 360 | 360 | if ($pc->getClassCategory1() != null && $pc->getClassCategory2() != null) { |
| 361 | - $this->addErrors(($data->key() + 1) . '行目の規格分類2(ID)に値を設定してください。'); |
|
| 361 | + $this->addErrors(($data->key() + 1).'行目の規格分類2(ID)に値を設定してください。'); |
|
| 362 | 362 | } |
| 363 | 363 | } |
| 364 | 364 | $ProductClass = $this->createProductClass($row, $Product, $app, $data, $ClassCategory1, $ClassCategory2); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | if (preg_match('/^\d+$/', $deliveryFee) && $deliveryFee >= 0) { |
| 370 | 370 | $ProductClass->setDeliveryFee($deliveryFee); |
| 371 | 371 | } else { |
| 372 | - $this->addErrors(($data->key() + 1) . '行目の送料は0以上の数値を設定してください。'); |
|
| 372 | + $this->addErrors(($data->key() + 1).'行目の送料は0以上の数値を設定してください。'); |
|
| 373 | 373 | } |
| 374 | 374 | } |
| 375 | 375 | } |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | foreach ($data as $row) { |
| 453 | 453 | |
| 454 | 454 | if ($headerSize != count($row)) { |
| 455 | - $this->addErrors(($data->key() + 1) . '行目のCSVフォーマットが一致しません。'); |
|
| 455 | + $this->addErrors(($data->key() + 1).'行目のCSVフォーマットが一致しません。'); |
|
| 456 | 456 | return $this->render($app, $form, $headers, $this->categoryTwig); |
| 457 | 457 | } |
| 458 | 458 | |
@@ -460,23 +460,23 @@ discard block |
||
| 460 | 460 | $Category = new Category(); |
| 461 | 461 | } else { |
| 462 | 462 | if (!preg_match('/^\d+$/', $row['カテゴリID'])) { |
| 463 | - $this->addErrors(($data->key() + 1) . '行目のカテゴリIDが存在しません。'); |
|
| 463 | + $this->addErrors(($data->key() + 1).'行目のカテゴリIDが存在しません。'); |
|
| 464 | 464 | return $this->render($app, $form, $headers, $this->categoryTwig); |
| 465 | 465 | } |
| 466 | 466 | $Category = $app['eccube.repository.category']->find($row['カテゴリID']); |
| 467 | 467 | if (!$Category) { |
| 468 | - $this->addErrors(($data->key() + 1) . '行目のカテゴリIDが存在しません。'); |
|
| 468 | + $this->addErrors(($data->key() + 1).'行目のカテゴリIDが存在しません。'); |
|
| 469 | 469 | return $this->render($app, $form, $headers, $this->categoryTwig); |
| 470 | 470 | } |
| 471 | 471 | if ($row['カテゴリID'] == $row['親カテゴリID']) { |
| 472 | - $this->addErrors(($data->key() + 1) . '行目のカテゴリIDと親カテゴリIDが同じです。'); |
|
| 472 | + $this->addErrors(($data->key() + 1).'行目のカテゴリIDと親カテゴリIDが同じです。'); |
|
| 473 | 473 | return $this->render($app, $form, $headers, $this->categoryTwig); |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | if (Str::isBlank($row['カテゴリ名'])) { |
| 479 | - $this->addErrors(($data->key() + 1) . '行目のカテゴリ名が設定されていません。'); |
|
| 479 | + $this->addErrors(($data->key() + 1).'行目のカテゴリ名が設定されていません。'); |
|
| 480 | 480 | return $this->render($app, $form, $headers, $this->categoryTwig); |
| 481 | 481 | } else { |
| 482 | 482 | $Category->setName(Str::trimAll($row['カテゴリ名'])); |
@@ -485,13 +485,13 @@ discard block |
||
| 485 | 485 | if ($row['親カテゴリID'] != '') { |
| 486 | 486 | |
| 487 | 487 | if (!preg_match('/^\d+$/', $row['親カテゴリID'])) { |
| 488 | - $this->addErrors(($data->key() + 1) . '行目の親カテゴリIDが存在しません。'); |
|
| 488 | + $this->addErrors(($data->key() + 1).'行目の親カテゴリIDが存在しません。'); |
|
| 489 | 489 | return $this->render($app, $form, $headers, $this->categoryTwig); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | $ParentCategory = $app['eccube.repository.category']->find($row['親カテゴリID']); |
| 493 | 493 | if (!$ParentCategory) { |
| 494 | - $this->addErrors(($data->key() + 1) . '行目の親カテゴリIDが存在しません。'); |
|
| 494 | + $this->addErrors(($data->key() + 1).'行目の親カテゴリIDが存在しません。'); |
|
| 495 | 495 | return $this->render($app, $form, $headers, $this->categoryTwig); |
| 496 | 496 | } |
| 497 | 497 | |
@@ -507,14 +507,14 @@ discard block |
||
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | if ($app['config']['category_nest_level'] < $Category->getLevel()) { |
| 510 | - $this->addErrors(($data->key() + 1) . '行目のカテゴリが最大レベルを超えているため設定できません。'); |
|
| 510 | + $this->addErrors(($data->key() + 1).'行目のカテゴリが最大レベルを超えているため設定できません。'); |
|
| 511 | 511 | return $this->render($app, $form, $headers, $this->categoryTwig); |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | $status = $app['eccube.repository.category']->save($Category); |
| 515 | 515 | |
| 516 | 516 | if (!$status) { |
| 517 | - $this->addErrors(($data->key() + 1) . '行目のカテゴリが設定できません。'); |
|
| 517 | + $this->addErrors(($data->key() + 1).'行目のカテゴリが設定できません。'); |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | if ($this->hasErrors()) { |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | throw new NotFoundHttpException(); |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - $response->setCallback(function () use ($app, $request, $headers) { |
|
| 560 | + $response->setCallback(function() use ($app, $request, $headers) { |
|
| 561 | 561 | |
| 562 | 562 | // ヘッダ行の出力 |
| 563 | 563 | $row = array(); |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | }); |
| 573 | 573 | |
| 574 | 574 | $response->headers->set('Content-Type', 'application/octet-stream'); |
| 575 | - $response->headers->set('Content-Disposition', 'attachment; filename=' . $filename); |
|
| 575 | + $response->headers->set('Content-Disposition', 'attachment; filename='.$filename); |
|
| 576 | 576 | $response->send(); |
| 577 | 577 | |
| 578 | 578 | return $response; |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | if (!empty($this->fileName)) { |
| 596 | 596 | try { |
| 597 | 597 | $fs = new Filesystem(); |
| 598 | - $fs->remove($app['config']['csv_temp_realdir'] . '/' . $this->fileName); |
|
| 598 | + $fs->remove($app['config']['csv_temp_realdir'].'/'.$this->fileName); |
|
| 599 | 599 | } catch (\Exception $e) { |
| 600 | 600 | // エラーが発生しても無視する |
| 601 | 601 | } |
@@ -618,10 +618,10 @@ discard block |
||
| 618 | 618 | protected function getImportData($app, $formFile) |
| 619 | 619 | { |
| 620 | 620 | // アップロードされたCSVファイルを一時ディレクトリに保存 |
| 621 | - $this->fileName = 'upload_' . Str::random() . '.' . $formFile->getClientOriginalExtension(); |
|
| 621 | + $this->fileName = 'upload_'.Str::random().'.'.$formFile->getClientOriginalExtension(); |
|
| 622 | 622 | $formFile->move($app['config']['csv_temp_realdir'], $this->fileName); |
| 623 | 623 | |
| 624 | - $file = file_get_contents($app['config']['csv_temp_realdir'] . '/' . $this->fileName); |
|
| 624 | + $file = file_get_contents($app['config']['csv_temp_realdir'].'/'.$this->fileName); |
|
| 625 | 625 | |
| 626 | 626 | if ('\\' === DIRECTORY_SEPARATOR && PHP_VERSION_ID >= 70000) { |
| 627 | 627 | // Windows 環境の PHP7 の場合はファイルエンコーディングを CP932 に合わせる |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | if (!$Tag) { |
| 776 | - $this->addErrors(($data->key() + 1) . '行目のタグ(ID)「' . $tag_id . '」が存在しません。'); |
|
| 776 | + $this->addErrors(($data->key() + 1).'行目のタグ(ID)「'.$tag_id.'」が存在しません。'); |
|
| 777 | 777 | } |
| 778 | 778 | } |
| 779 | 779 | } |
@@ -791,17 +791,17 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | |
| 793 | 793 | if ($row['商品種別(ID)'] == '') { |
| 794 | - $this->addErrors(($data->key() + 1) . '行目の商品種別(ID)が設定されていません。'); |
|
| 794 | + $this->addErrors(($data->key() + 1).'行目の商品種別(ID)が設定されていません。'); |
|
| 795 | 795 | } else { |
| 796 | 796 | if (preg_match('/^\d+$/', $row['商品種別(ID)'])) { |
| 797 | 797 | $ProductType = $app['eccube.repository.master.product_type']->find($row['商品種別(ID)']); |
| 798 | 798 | if (!$ProductType) { |
| 799 | - $this->addErrors(($data->key() + 1) . '行目の商品種別(ID)が存在しません。'); |
|
| 799 | + $this->addErrors(($data->key() + 1).'行目の商品種別(ID)が存在しません。'); |
|
| 800 | 800 | } else { |
| 801 | 801 | $ProductClass->setProductType($ProductType); |
| 802 | 802 | } |
| 803 | 803 | } else { |
| 804 | - $this->addErrors(($data->key() + 1) . '行目の商品種別(ID)が存在しません。'); |
|
| 804 | + $this->addErrors(($data->key() + 1).'行目の商品種別(ID)が存在しません。'); |
|
| 805 | 805 | } |
| 806 | 806 | } |
| 807 | 807 | |
@@ -812,12 +812,12 @@ discard block |
||
| 812 | 812 | if (preg_match('/^\d+$/', $row['発送日目安(ID)'])) { |
| 813 | 813 | $DeliveryDate = $app['eccube.repository.delivery_date']->find($row['発送日目安(ID)']); |
| 814 | 814 | if (!$DeliveryDate) { |
| 815 | - $this->addErrors(($data->key() + 1) . '行目の発送日目安(ID)が存在しません。'); |
|
| 815 | + $this->addErrors(($data->key() + 1).'行目の発送日目安(ID)が存在しません。'); |
|
| 816 | 816 | } else { |
| 817 | 817 | $ProductClass->setDeliveryDate($DeliveryDate); |
| 818 | 818 | } |
| 819 | 819 | } else { |
| 820 | - $this->addErrors(($data->key() + 1) . '行目の発送日目安(ID)が存在しません。'); |
|
| 820 | + $this->addErrors(($data->key() + 1).'行目の発送日目安(ID)が存在しません。'); |
|
| 821 | 821 | } |
| 822 | 822 | } |
| 823 | 823 | |
@@ -828,19 +828,19 @@ discard block |
||
| 828 | 828 | } |
| 829 | 829 | |
| 830 | 830 | if ($row['在庫数無制限フラグ'] == '') { |
| 831 | - $this->addErrors(($data->key() + 1) . '行目の在庫数無制限フラグが設定されていません。'); |
|
| 831 | + $this->addErrors(($data->key() + 1).'行目の在庫数無制限フラグが設定されていません。'); |
|
| 832 | 832 | } else { |
| 833 | 833 | if ($row['在庫数無制限フラグ'] == (string) Constant::DISABLED) { |
| 834 | 834 | $ProductClass->setStockUnlimited(Constant::DISABLED); |
| 835 | 835 | // 在庫数が設定されていなければエラー |
| 836 | 836 | if ($row['在庫数'] == '') { |
| 837 | - $this->addErrors(($data->key() + 1) . '行目の在庫数が設定されていません。'); |
|
| 837 | + $this->addErrors(($data->key() + 1).'行目の在庫数が設定されていません。'); |
|
| 838 | 838 | } else { |
| 839 | 839 | $stock = str_replace(',', '', $row['在庫数']); |
| 840 | 840 | if (preg_match('/^\d+$/', $stock) && $stock >= 0) { |
| 841 | 841 | $ProductClass->setStock($stock); |
| 842 | 842 | } else { |
| 843 | - $this->addErrors(($data->key() + 1) . '行目の在庫数は0以上の数値を設定してください。'); |
|
| 843 | + $this->addErrors(($data->key() + 1).'行目の在庫数は0以上の数値を設定してください。'); |
|
| 844 | 844 | } |
| 845 | 845 | } |
| 846 | 846 | |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | $ProductClass->setStockUnlimited(Constant::ENABLED); |
| 849 | 849 | $ProductClass->setStock(null); |
| 850 | 850 | } else { |
| 851 | - $this->addErrors(($data->key() + 1) . '行目の在庫数無制限フラグが設定されていません。'); |
|
| 851 | + $this->addErrors(($data->key() + 1).'行目の在庫数無制限フラグが設定されていません。'); |
|
| 852 | 852 | } |
| 853 | 853 | } |
| 854 | 854 | |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | if (preg_match('/^\d+$/', $saleLimit) && $saleLimit >= 0) { |
| 858 | 858 | $ProductClass->setSaleLimit($saleLimit); |
| 859 | 859 | } else { |
| 860 | - $this->addErrors(($data->key() + 1) . '行目の販売制限数は0以上の数値を設定してください。'); |
|
| 860 | + $this->addErrors(($data->key() + 1).'行目の販売制限数は0以上の数値を設定してください。'); |
|
| 861 | 861 | } |
| 862 | 862 | } |
| 863 | 863 | |
@@ -866,18 +866,18 @@ discard block |
||
| 866 | 866 | if (preg_match('/^\d+$/', $price01) && $price01 >= 0) { |
| 867 | 867 | $ProductClass->setPrice01($price01); |
| 868 | 868 | } else { |
| 869 | - $this->addErrors(($data->key() + 1) . '行目の通常価格は0以上の数値を設定してください。'); |
|
| 869 | + $this->addErrors(($data->key() + 1).'行目の通常価格は0以上の数値を設定してください。'); |
|
| 870 | 870 | } |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | if ($row['販売価格'] == '') { |
| 874 | - $this->addErrors(($data->key() + 1) . '行目の販売価格が設定されていません。'); |
|
| 874 | + $this->addErrors(($data->key() + 1).'行目の販売価格が設定されていません。'); |
|
| 875 | 875 | } else { |
| 876 | 876 | $price02 = str_replace(',', '', $row['販売価格']); |
| 877 | 877 | if (preg_match('/^\d+$/', $price02) && $price02 >= 0) { |
| 878 | 878 | $ProductClass->setPrice02($price02); |
| 879 | 879 | } else { |
| 880 | - $this->addErrors(($data->key() + 1) . '行目の販売価格は0以上の数値を設定してください。'); |
|
| 880 | + $this->addErrors(($data->key() + 1).'行目の販売価格は0以上の数値を設定してください。'); |
|
| 881 | 881 | } |
| 882 | 882 | } |
| 883 | 883 | |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | if (preg_match('/^\d+$/', $delivery_fee) && $delivery_fee >= 0) { |
| 887 | 887 | $ProductClass->setDeliveryFee($delivery_fee); |
| 888 | 888 | } else { |
| 889 | - $this->addErrors(($data->key() + 1) . '行目の送料は0以上の数値を設定してください。'); |
|
| 889 | + $this->addErrors(($data->key() + 1).'行目の送料は0以上の数値を設定してください。'); |
|
| 890 | 890 | } |
| 891 | 891 | } |
| 892 | 892 | |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | if ($row['商品規格削除フラグ'] == (string) Constant::DISABLED || $row['商品規格削除フラグ'] == (string) Constant::ENABLED) { |
| 897 | 897 | $ProductClass->setDelFlg($row['商品規格削除フラグ']); |
| 898 | 898 | } else { |
| 899 | - $this->addErrors(($data->key() + 1) . '行目の商品規格削除フラグが設定されていません。'); |
|
| 899 | + $this->addErrors(($data->key() + 1).'行目の商品規格削除フラグが設定されていません。'); |
|
| 900 | 900 | } |
| 901 | 901 | } |
| 902 | 902 | |
@@ -929,17 +929,17 @@ discard block |
||
| 929 | 929 | $ProductClass->setProduct($Product); |
| 930 | 930 | |
| 931 | 931 | if ($row['商品種別(ID)'] == '') { |
| 932 | - $this->addErrors(($data->key() + 1) . '行目の商品種別(ID)が設定されていません。'); |
|
| 932 | + $this->addErrors(($data->key() + 1).'行目の商品種別(ID)が設定されていません。'); |
|
| 933 | 933 | } else { |
| 934 | 934 | if (preg_match('/^\d+$/', $row['商品種別(ID)'])) { |
| 935 | 935 | $ProductType = $app['eccube.repository.master.product_type']->find($row['商品種別(ID)']); |
| 936 | 936 | if (!$ProductType) { |
| 937 | - $this->addErrors(($data->key() + 1) . '行目の商品種別(ID)が存在しません。'); |
|
| 937 | + $this->addErrors(($data->key() + 1).'行目の商品種別(ID)が存在しません。'); |
|
| 938 | 938 | } else { |
| 939 | 939 | $ProductClass->setProductType($ProductType); |
| 940 | 940 | } |
| 941 | 941 | } else { |
| 942 | - $this->addErrors(($data->key() + 1) . '行目の商品種別(ID)が存在しません。'); |
|
| 942 | + $this->addErrors(($data->key() + 1).'行目の商品種別(ID)が存在しません。'); |
|
| 943 | 943 | } |
| 944 | 944 | } |
| 945 | 945 | |
@@ -948,12 +948,12 @@ discard block |
||
| 948 | 948 | if (preg_match('/^\d+$/', $row['規格分類1(ID)'])) { |
| 949 | 949 | $ClassCategory = $app['eccube.repository.class_category']->find($row['規格分類1(ID)']); |
| 950 | 950 | if (!$ClassCategory) { |
| 951 | - $this->addErrors(($data->key() + 1) . '行目の規格分類1(ID)が存在しません。'); |
|
| 951 | + $this->addErrors(($data->key() + 1).'行目の規格分類1(ID)が存在しません。'); |
|
| 952 | 952 | } else { |
| 953 | 953 | $ProductClass->setClassCategory1($ClassCategory); |
| 954 | 954 | } |
| 955 | 955 | } else { |
| 956 | - $this->addErrors(($data->key() + 1) . '行目の規格分類1(ID)が存在しません。'); |
|
| 956 | + $this->addErrors(($data->key() + 1).'行目の規格分類1(ID)が存在しません。'); |
|
| 957 | 957 | } |
| 958 | 958 | } |
| 959 | 959 | |
@@ -961,12 +961,12 @@ discard block |
||
| 961 | 961 | if (preg_match('/^\d+$/', $row['規格分類2(ID)'])) { |
| 962 | 962 | $ClassCategory = $app['eccube.repository.class_category']->find($row['規格分類2(ID)']); |
| 963 | 963 | if (!$ClassCategory) { |
| 964 | - $this->addErrors(($data->key() + 1) . '行目の規格分類2(ID)が存在しません。'); |
|
| 964 | + $this->addErrors(($data->key() + 1).'行目の規格分類2(ID)が存在しません。'); |
|
| 965 | 965 | } else { |
| 966 | 966 | $ProductClass->setClassCategory2($ClassCategory); |
| 967 | 967 | } |
| 968 | 968 | } else { |
| 969 | - $this->addErrors(($data->key() + 1) . '行目の規格分類2(ID)が存在しません。'); |
|
| 969 | + $this->addErrors(($data->key() + 1).'行目の規格分類2(ID)が存在しません。'); |
|
| 970 | 970 | } |
| 971 | 971 | } |
| 972 | 972 | |
@@ -974,12 +974,12 @@ discard block |
||
| 974 | 974 | if (preg_match('/^\d+$/', $row['発送日目安(ID)'])) { |
| 975 | 975 | $DeliveryDate = $app['eccube.repository.delivery_date']->find($row['発送日目安(ID)']); |
| 976 | 976 | if (!$DeliveryDate) { |
| 977 | - $this->addErrors(($data->key() + 1) . '行目の発送日目安(ID)が存在しません。'); |
|
| 977 | + $this->addErrors(($data->key() + 1).'行目の発送日目安(ID)が存在しません。'); |
|
| 978 | 978 | } else { |
| 979 | 979 | $ProductClass->setDeliveryDate($DeliveryDate); |
| 980 | 980 | } |
| 981 | 981 | } else { |
| 982 | - $this->addErrors(($data->key() + 1) . '行目の発送日目安(ID)が存在しません。'); |
|
| 982 | + $this->addErrors(($data->key() + 1).'行目の発送日目安(ID)が存在しません。'); |
|
| 983 | 983 | } |
| 984 | 984 | } |
| 985 | 985 | |
@@ -990,19 +990,19 @@ discard block |
||
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | if ($row['在庫数無制限フラグ'] == '') { |
| 993 | - $this->addErrors(($data->key() + 1) . '行目の在庫数無制限フラグが設定されていません。'); |
|
| 993 | + $this->addErrors(($data->key() + 1).'行目の在庫数無制限フラグが設定されていません。'); |
|
| 994 | 994 | } else { |
| 995 | 995 | if ($row['在庫数無制限フラグ'] == (string) Constant::DISABLED) { |
| 996 | 996 | $ProductClass->setStockUnlimited(Constant::DISABLED); |
| 997 | 997 | // 在庫数が設定されていなければエラー |
| 998 | 998 | if ($row['在庫数'] == '') { |
| 999 | - $this->addErrors(($data->key() + 1) . '行目の在庫数が設定されていません。'); |
|
| 999 | + $this->addErrors(($data->key() + 1).'行目の在庫数が設定されていません。'); |
|
| 1000 | 1000 | } else { |
| 1001 | 1001 | $stock = str_replace(',', '', $row['在庫数']); |
| 1002 | 1002 | if (preg_match('/^\d+$/', $stock) && $stock >= 0) { |
| 1003 | 1003 | $ProductClass->setStock($row['在庫数']); |
| 1004 | 1004 | } else { |
| 1005 | - $this->addErrors(($data->key() + 1) . '行目の在庫数は0以上の数値を設定してください。'); |
|
| 1005 | + $this->addErrors(($data->key() + 1).'行目の在庫数は0以上の数値を設定してください。'); |
|
| 1006 | 1006 | } |
| 1007 | 1007 | } |
| 1008 | 1008 | |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | $ProductClass->setStockUnlimited(Constant::ENABLED); |
| 1011 | 1011 | $ProductClass->setStock(null); |
| 1012 | 1012 | } else { |
| 1013 | - $this->addErrors(($data->key() + 1) . '行目の在庫数無制限フラグが設定されていません。'); |
|
| 1013 | + $this->addErrors(($data->key() + 1).'行目の在庫数無制限フラグが設定されていません。'); |
|
| 1014 | 1014 | } |
| 1015 | 1015 | } |
| 1016 | 1016 | |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | if (preg_match('/^\d+$/', $saleLimit) && $saleLimit >= 0) { |
| 1020 | 1020 | $ProductClass->setSaleLimit($saleLimit); |
| 1021 | 1021 | } else { |
| 1022 | - $this->addErrors(($data->key() + 1) . '行目の販売制限数は0以上の数値を設定してください。'); |
|
| 1022 | + $this->addErrors(($data->key() + 1).'行目の販売制限数は0以上の数値を設定してください。'); |
|
| 1023 | 1023 | } |
| 1024 | 1024 | } |
| 1025 | 1025 | |
@@ -1028,18 +1028,18 @@ discard block |
||
| 1028 | 1028 | if (preg_match('/^\d+$/', $price01) && $price01 >= 0) { |
| 1029 | 1029 | $ProductClass->setPrice01($price01); |
| 1030 | 1030 | } else { |
| 1031 | - $this->addErrors(($data->key() + 1) . '行目の通常価格は0以上の数値を設定してください。'); |
|
| 1031 | + $this->addErrors(($data->key() + 1).'行目の通常価格は0以上の数値を設定してください。'); |
|
| 1032 | 1032 | } |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | if ($row['販売価格'] == '') { |
| 1036 | - $this->addErrors(($data->key() + 1) . '行目の販売価格が設定されていません。'); |
|
| 1036 | + $this->addErrors(($data->key() + 1).'行目の販売価格が設定されていません。'); |
|
| 1037 | 1037 | } else { |
| 1038 | 1038 | $price02 = str_replace(',', '', $row['販売価格']); |
| 1039 | 1039 | if (preg_match('/^\d+$/', $price02) && $price02 >= 0) { |
| 1040 | 1040 | $ProductClass->setPrice02($price02); |
| 1041 | 1041 | } else { |
| 1042 | - $this->addErrors(($data->key() + 1) . '行目の販売価格は0以上の数値を設定してください。'); |
|
| 1042 | + $this->addErrors(($data->key() + 1).'行目の販売価格は0以上の数値を設定してください。'); |
|
| 1043 | 1043 | } |
| 1044 | 1044 | } |
| 1045 | 1045 | |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | if ($row['商品規格削除フラグ'] == (string) Constant::DISABLED || $row['商品規格削除フラグ'] == (string) Constant::ENABLED) { |
| 1050 | 1050 | $ProductClass->setDelFlg($row['商品規格削除フラグ']); |
| 1051 | 1051 | } else { |
| 1052 | - $this->addErrors(($data->key() + 1) . '行目の商品規格削除フラグが設定されていません。'); |
|
| 1052 | + $this->addErrors(($data->key() + 1).'行目の商品規格削除フラグが設定されていません。'); |
|
| 1053 | 1053 | } |
| 1054 | 1054 | } |
| 1055 | 1055 | |
@@ -517,6 +517,8 @@ discard block |
||
| 517 | 517 | /** |
| 518 | 518 | * 登録、更新時のエラー画面表示 |
| 519 | 519 | * |
| 520 | + * @param Application $app |
|
| 521 | + * @param boolean $not_product_class |
|
| 520 | 522 | */ |
| 521 | 523 | protected function render($app, $Product, $ProductClass, $not_product_class, $classForm, $error = null) |
| 522 | 524 | { |
@@ -566,6 +568,7 @@ discard block |
||
| 566 | 568 | |
| 567 | 569 | /** |
| 568 | 570 | * 規格1と規格2を組み合わせた商品規格を作成 |
| 571 | + * @param Application $app |
|
| 569 | 572 | */ |
| 570 | 573 | private function createProductClasses($app, Product $Product, ClassName $ClassName1 = null, ClassName $ClassName2 = null) |
| 571 | 574 | { |
@@ -653,6 +656,7 @@ discard block |
||
| 653 | 656 | * |
| 654 | 657 | * @param $productClassDest コピー先となる商品規格 |
| 655 | 658 | * @param $productClassOrig コピー元となる商品規格 |
| 659 | + * @param Application $app |
|
| 656 | 660 | */ |
| 657 | 661 | private function setDefualtProductClass($app, $productClassDest, $productClassOrig) { |
| 658 | 662 | $productClassDest->setDeliveryDate($productClassOrig->getDeliveryDate()); |
@@ -695,6 +699,7 @@ discard block |
||
| 695 | 699 | * 商品規格を登録 |
| 696 | 700 | * |
| 697 | 701 | * @param $ProductClasses 登録される商品規格 |
| 702 | + * @param Application $app |
|
| 698 | 703 | */ |
| 699 | 704 | private function insertProductClass($app, $Product, $ProductClasses) { |
| 700 | 705 | |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | 'allow_add' => true, |
| 139 | 139 | 'allow_delete' => true, |
| 140 | 140 | 'data' => $ProductClasses, |
| 141 | - )); |
|
| 141 | + )); |
|
| 142 | 142 | |
| 143 | 143 | $event = new EventArgs( |
| 144 | 144 | array( |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | $class2Valied = $this->isValiedCategory($ClassName2); |
| 107 | 107 | |
| 108 | 108 | // 規格が選択されていないか、選択された状態で分類が保有されていれば、画面表示 |
| 109 | - if($class1Valied && $class2Valied){ |
|
| 109 | + if ($class1Valied && $class2Valied) { |
|
| 110 | 110 | $hasClassCategoryFlg = true; |
| 111 | 111 | } |
| 112 | 112 | |
@@ -36,7 +36,6 @@ |
||
| 36 | 36 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
| 37 | 37 | use Symfony\Component\Routing\Exception\RouteNotFoundException; |
| 38 | 38 | use Symfony\Component\Validator\Constraints as Assert; |
| 39 | -use Symfony\Component\Form\FormError; |
|
| 40 | 39 | use Monolog\Logger; |
| 41 | 40 | |
| 42 | 41 | class PluginController extends AbstractController |
@@ -28,7 +28,6 @@ |
||
| 28 | 28 | use Eccube\Entity\Master\DeviceType; |
| 29 | 29 | use Eccube\Util\Str; |
| 30 | 30 | use Symfony\Component\Filesystem\Filesystem; |
| 31 | -use Symfony\Component\Finder\Finder; |
|
| 32 | 31 | use Symfony\Component\Form\FormError; |
| 33 | 32 | use Symfony\Component\HttpFoundation\Request; |
| 34 | 33 | use Symfony\Component\HttpFoundation\Response; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $config['template_realdir'] = $config['root_dir'].'/app/template/'.$templateCode; |
| 78 | 78 | $config['template_html_realdir'] = $config['public_path_realdir'].'/template/'.$templateCode; |
| 79 | 79 | $config['front_urlpath'] = $config['root_urlpath'].RELATIVE_PUBLIC_DIR_PATH.'/template/'.$templateCode; |
| 80 | - $config['block_realdir'] =$config['template_realdir'].'/Block'; |
|
| 80 | + $config['block_realdir'] = $config['template_realdir'].'/Block'; |
|
| 81 | 81 | |
| 82 | 82 | if (file_exists($file.'.php')) { |
| 83 | 83 | file_put_contents($file.'.php', sprintf('<?php return %s', var_export($config, true)).';'); |
@@ -117,19 +117,19 @@ discard block |
||
| 117 | 117 | // 該当テンプレートのディレクトリ |
| 118 | 118 | $config = $app['config']; |
| 119 | 119 | $templateCode = $Template->getCode(); |
| 120 | - $targetRealDir = $config['root_dir'] . '/app/template/' . $templateCode; |
|
| 121 | - $targetHtmlRealDir = $config['root_dir'] . '/html/template/' . $templateCode; |
|
| 120 | + $targetRealDir = $config['root_dir'].'/app/template/'.$templateCode; |
|
| 121 | + $targetHtmlRealDir = $config['root_dir'].'/html/template/'.$templateCode; |
|
| 122 | 122 | |
| 123 | 123 | // 一時ディレクトリ |
| 124 | 124 | $uniqId = sha1(Str::random(32)); |
| 125 | - $tmpDir = $config['template_temp_realdir'] . '/' . $uniqId; |
|
| 126 | - $appDir = $tmpDir . '/app'; |
|
| 127 | - $htmlDir = $tmpDir . '/html'; |
|
| 125 | + $tmpDir = $config['template_temp_realdir'].'/'.$uniqId; |
|
| 126 | + $appDir = $tmpDir.'/app'; |
|
| 127 | + $htmlDir = $tmpDir.'/html'; |
|
| 128 | 128 | |
| 129 | 129 | // ファイル名 |
| 130 | - $tarFile = $config['template_temp_realdir'] . '/' . $uniqId . '.tar'; |
|
| 131 | - $tarGzFile = $tarFile . '.gz'; |
|
| 132 | - $downloadFileName = $Template->getCode() . '.tar.gz'; |
|
| 130 | + $tarFile = $config['template_temp_realdir'].'/'.$uniqId.'.tar'; |
|
| 131 | + $tarGzFile = $tarFile.'.gz'; |
|
| 132 | + $downloadFileName = $Template->getCode().'.tar.gz'; |
|
| 133 | 133 | |
| 134 | 134 | // 該当テンプレートを一時ディレクトリへコピーする. |
| 135 | 135 | $fs = new Filesystem(); |
@@ -149,14 +149,14 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | // ダウンロード完了後にファイルを削除する. |
| 151 | 151 | // http://stackoverflow.com/questions/15238897/removing-file-after-delivering-response-with-silex-symfony |
| 152 | - $app->finish(function (Request $request, Response $response, \Silex\Application $app) use ( |
|
| 152 | + $app->finish(function(Request $request, Response $response, \Silex\Application $app) use ( |
|
| 153 | 153 | $tmpDir, |
| 154 | 154 | $tarFile, |
| 155 | 155 | $tarGzFile |
| 156 | 156 | ) { |
| 157 | - $app['monolog']->addDebug('remove temp file: ' . $tmpDir); |
|
| 158 | - $app['monolog']->addDebug('remove temp file: ' . $tarFile); |
|
| 159 | - $app['monolog']->addDebug('remove temp file: ' . $tarGzFile); |
|
| 157 | + $app['monolog']->addDebug('remove temp file: '.$tmpDir); |
|
| 158 | + $app['monolog']->addDebug('remove temp file: '.$tarFile); |
|
| 159 | + $app['monolog']->addDebug('remove temp file: '.$tarGzFile); |
|
| 160 | 160 | $fs = new Filesystem(); |
| 161 | 161 | $fs->remove($tmpDir); |
| 162 | 162 | $fs->remove($tarFile); |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | // テンプレートディレクトリの削除 |
| 198 | 198 | $config = $app['config']; |
| 199 | 199 | $templateCode = $Template->getCode(); |
| 200 | - $targetRealDir = $config['root_dir'] . '/app/template/' . $templateCode; |
|
| 201 | - $targetHtmlRealDir = $config['root_dir'] . '/html/template/' . $templateCode; |
|
| 200 | + $targetRealDir = $config['root_dir'].'/app/template/'.$templateCode; |
|
| 201 | + $targetHtmlRealDir = $config['root_dir'].'/html/template/'.$templateCode; |
|
| 202 | 202 | |
| 203 | 203 | $fs = new Filesystem(); |
| 204 | 204 | $fs->remove($targetRealDir); |
@@ -241,18 +241,18 @@ discard block |
||
| 241 | 241 | // 該当テンプレートのディレクトリ |
| 242 | 242 | $config = $app['config']; |
| 243 | 243 | $templateCode = $Template->getCode(); |
| 244 | - $targetRealDir = $config['root_dir'] . '/app/template/' . $templateCode; |
|
| 245 | - $targetHtmlRealDir = $config['root_dir'] . '/html/template/' . $templateCode; |
|
| 244 | + $targetRealDir = $config['root_dir'].'/app/template/'.$templateCode; |
|
| 245 | + $targetHtmlRealDir = $config['root_dir'].'/html/template/'.$templateCode; |
|
| 246 | 246 | |
| 247 | 247 | // 一時ディレクトリ |
| 248 | 248 | $uniqId = sha1(Str::random(32)); |
| 249 | - $tmpDir = $config['template_temp_realdir'] . '/' . $uniqId; |
|
| 250 | - $appDir = $tmpDir . '/app'; |
|
| 251 | - $htmlDir = $tmpDir . '/html'; |
|
| 249 | + $tmpDir = $config['template_temp_realdir'].'/'.$uniqId; |
|
| 250 | + $appDir = $tmpDir.'/app'; |
|
| 251 | + $htmlDir = $tmpDir.'/html'; |
|
| 252 | 252 | |
| 253 | 253 | $formFile = $form['file']->getData(); |
| 254 | 254 | // ファイル名 |
| 255 | - $archive = $templateCode . '.' . $formFile->getClientOriginalExtension(); |
|
| 255 | + $archive = $templateCode.'.'.$formFile->getClientOriginalExtension(); |
|
| 256 | 256 | |
| 257 | 257 | // ファイルを一時ディレクトリへ移動. |
| 258 | 258 | $formFile->move($tmpDir, $archive); |
@@ -261,11 +261,11 @@ discard block |
||
| 261 | 261 | try { |
| 262 | 262 | if ($formFile->getClientOriginalExtension() == 'zip') { |
| 263 | 263 | $zip = new \ZipArchive(); |
| 264 | - $zip->open($tmpDir . '/' . $archive); |
|
| 264 | + $zip->open($tmpDir.'/'.$archive); |
|
| 265 | 265 | $zip->extractTo($tmpDir); |
| 266 | 266 | $zip->close(); |
| 267 | 267 | } else { |
| 268 | - $phar = new \PharData($tmpDir . '/' . $archive); |
|
| 268 | + $phar = new \PharData($tmpDir.'/'.$archive); |
|
| 269 | 269 | $phar->extractTo($tmpDir, null, true); |
| 270 | 270 | } |
| 271 | 271 | } catch (\Exception $e) { |