Skip to content

Instantly share code, notes, and snippets.

@akovalyov
Created April 14, 2017 15:03
Show Gist options
  • Save akovalyov/a7378f75313fff61652b18246f81d879 to your computer and use it in GitHub Desktop.
Save akovalyov/a7378f75313fff61652b18246f81d879 to your computer and use it in GitHub Desktop.
#!/usr/bin/env php
<?php
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);
set_time_limit(0);
/** @var Composer\Autoload\ClassLoader $loader */
$loader = require __DIR__.'/../app/autoload.php';
$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
if ($debug) {
Debug::enable();
}
$kernel = new AppKernel($env, $debug);
$application = new Application($kernel);
$application->setAutoExit(false);
$application->run(new \Symfony\Component\Console\Input\ArrayInput([
'command' => 'doctrine:database:drop',
'--force' => true,
'--if-exists' => true,
]));
$application->run(new \Symfony\Component\Console\Input\ArrayInput([
'command' => 'doctrine:database:create',
]));
$application->run(new \Symfony\Component\Console\Input\ArrayInput([
'command' => 'doctrine:migrations:migrate',
'--no-interaction' => true,
]));
$application->run(new \Symfony\Component\Console\Input\ArrayInput([
'command' => 'rad:fixtures:load',
]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment