Skip to content

Commit

Permalink
bin/console コマンドを動作するよう修正
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Dec 6, 2017
1 parent e11dd5b commit 39d8d8e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
33 changes: 33 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env php
<?php

use Eccube\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;

umask(0000);
set_time_limit(0);

require __DIR__.'/../vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

if (!isset($_SERVER['APP_ENV'])) {
(new Dotenv())->load(__DIR__.'/../.env');
}

$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev');
$debug = ($_SERVER['APP_DEBUG'] ?? true) !== '0' && !$input->hasParameterOption(['--no-debug', '']);

if ($debug && class_exists(Debug::class)) {
Debug::enable();
}

$kernel = new Kernel($env, $debug);
$application = new Application($kernel);
$application->run($input);
4 changes: 3 additions & 1 deletion src/Eccube/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ public function register(ServiceProviderInterface $provider, array $values = arr
public function boot()
{
parent::boot();
require __DIR__.'/../../app/cache/provider/ServiceProviderCache.php';
if (!class_exists('\ServiceProviderCache')) {
require __DIR__.'/../../app/cache/provider/ServiceProviderCache.php';
}

$em = $this->container->get('doctrine')->getManager();
$this->app = $this->container->get('app');
Expand Down

0 comments on commit 39d8d8e

Please sign in to comment.