Пример #1
0
 function run()
 {
     $app = new \Symfony\Component\Console\Application();
     foreach ($this->commands() as $command) {
         $app->add(new $command());
     }
     $app->run();
 }
Пример #2
0
 static function run($container)
 {
     $application = new \Symfony\Component\Console\Application();
     $application->add(new ViewCommand(null, $container));
     $application->add(new BatchCommand(null, $container));
     $application->add(new AssetsCommand(null, $container));
     $application->add(new ControllerCommand(null, $container));
     $application->add(new CacheCommand(null, $container));
     $application->run();
 }
Пример #3
0
 function run()
 {
     $this->dmx = new \DmxHttp\Controller\DMXPost();
     $this->dmx->addDevice(new Spot(6));
     $this->dmx->addDevice(new Spot(12));
     $this->dmx->addDevice(new Spot(18));
     $this->dmx->addDevice(new Spot(24));
     $this->dmx->addDevice(new Spot(30));
     $this->dmx->addDevice(new Spot(36));
     $this->dmx->addDevice(new Spot(42));
     $this->dmx->addDevice(new Spot(48));
     $this->dmx->addDevice(new Scanner(300));
     $this->dmx->addDevice(new Scanner(305));
     $this->dmx->addDevice(new Scanner(310));
     $this->dmx->addDevice(new Scanner(314));
     $console = new \Symfony\Component\Console\Application();
     $console->register("ls")->setDefinition(array())->setDescription("list devices")->setCode(function (\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output) {
         $table = new \Symfony\Component\Console\Helper\Table($output);
         $table->setHeaders(array('Start Channel', 'Type', 'status'));
         foreach ($this->dmx->getDevices() as $device) {
             $table->addRow([$device->getStartChannel(), get_class($device), '[' . implode(',', $device->getChannels()) . ']']);
         }
         $table->render();
     });
     $console->register("run")->setDefinition(array(new InputArgument('device', InputArgument::REQUIRED, 'start channel of a device'), new InputArgument('method', InputArgument::REQUIRED, 'method'), new InputArgument('args', InputArgument::IS_ARRAY, 'arguments')))->setDescription("set command")->setCode(function (InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output) {
         $device = null;
         foreach ($this->dmx->getDevices() as $_device) {
             if ($_device->getStartChannel() == $input->getArgument("device")) {
                 $device = $_device;
                 break;
             }
         }
         if ($device === null) {
             $output->writeln("<error>can't find device</error>");
             return 1;
         }
         $method = $input->getArgument("method");
         $args = $input->getArgument("args");
         call_user_func_array([$device, $method], $args);
         $this->dmx->send();
     });
     $console->run();
 }
Пример #4
0
<?php

$environment = strtolower(getenv('APPLICATION_ENV'));
if (!$environment) {
    echo 'APPLICATION_ENV must be configured!' . PHP_EOL;
    exit(255);
}
$di = (include realpath(__DIR__ . '/../') . '/configs/bootstrap.php');
$di->get('config')->logger->default_name = 'console';
$di->get('error_catcher')->register();
$di->get('error_catcher')->setFatalCallback(function ($message) use($di) {
    $di->get('logger_helper')->getLogger()->emergency($message);
});
$di->get('error_catcher')->setExceptionCallback(function (\Exception $exception) use($di) {
    $di->get('logger_helper')->getLogger()->error($exception);
});
$doctrineConn = \Doctrine\DBAL\DriverManager::getConnection(array('driver' => 'pdo_mysql', 'pdo' => $di->get('pdo')));
$symfonyConsoleApp = new \Symfony\Component\Console\Application();
$symfonyConsoleApp->getHelperSet()->set(new \Pozitim\Console\DiHelper($di));
$symfonyConsoleApp->getHelperSet()->set(new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($doctrineConn));
$symfonyConsoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand());
$symfonyConsoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand());
$symfonyConsoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand());
$symfonyConsoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand());
$symfonyConsoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\LatestCommand());
$symfonyConsoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand());
$symfonyConsoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand());
$symfonyConsoleApp->add(new \Pozitim\CI\Console\ComposeRunnerCommand());
$symfonyConsoleApp->run();
Пример #5
0
            $result[$span['a']['title']] = [$span['a']['title'], max($span['e']) - min($span['b']), count($span['b'])];
        } else {
            $result[$span['a']['title']][1] += max($span['e']) - min($span['b']);
            $result[$span['a']['title']][2] += count($span['b']);
        }
    }
    return $result;
};
$console->register('analyze')->setDefinition(array())->setDescription('Displays the files in the given directory')->setCode(function (\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output) use($flatten_spans) {
    $file = __DIR__ . '/../local/trace_17186.json';
    $file = __DIR__ . '/../local/trace_17717.json';
    $trace = json_decode(file_get_contents($file), true);
    $appInfo = array_shift($trace['spans']);
    $output->writeln('App run info:');
    $table = new \Symfony\Component\Console\Helper\Table($output);
    $table->setRows(array(array('id', $trace['id']), array('TransactionName', $trace['tx']), array('PHP Version:', $appInfo['a']['php']), array('title:', $appInfo['a']['title'])));
    $table->render();
    $output->writeln('App Summary:');
    $table = new \Symfony\Component\Console\Helper\Table($output);
    $tableStyleRightAligned = new \Symfony\Component\Console\Helper\TableStyle();
    $tableStyleRightAligned->setPadType(STR_PAD_LEFT);
    $table->setColumnStyle(1, $tableStyleRightAligned);
    $table->setRows(array(array('compile count:', $appInfo['a']['cct'] ?? ''), array('compile Wall Time:', $appInfo['a']['cwt'] ?? ''), array('compile CPU Time:', $appInfo['a']['cpu']), array('Garbage Collection Runs:', $appInfo['a']['gc'] ?? ''), array('Garbage Collected:', $appInfo['a']['gcc'] ?? '')));
    $table->render();
    $table = new \Symfony\Component\Console\Helper\Table($output);
    $table->setHeaders(array('title', 'time', 'call count'))->setRows($flatten_spans($trace['spans']));
    $table->render();
    $output->writeln('End of command');
});
$console->run();
Пример #6
0
 public function executeDoctrine(array $arguments)
 {
     $_SERVER['argv'] = array_slice($arguments, 1);
     $cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', \Doctrine\Common\Version::VERSION);
     $cli->setCatchExceptions(true);
     $helperSet = $cli->getHelperSet();
     $helpers = array('em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($this->cx->getDb()->getEntityManager()));
     foreach ($helpers as $name => $helper) {
         $helperSet->set($helper, $name);
     }
     $cli->addCommands(array(new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(), new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(), new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(), new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand()));
     $cli->setAutoExit(false);
     return $cli->run();
 }
Пример #7
0
<?php

/**
 * @var \MiniFrame\Di\Di $diImpl
 */
$environment = strtolower(getenv('APPLICATION_ENV'));
$diImpl = (include realpath(__DIR__ . '/../') . '/configs/bootstrap.php');
$diImpl->get('configs')->logger->name = 'console';
$diImpl->get('error_catcher')->register();
$consoleApp = new \Symfony\Component\Console\Application($diImpl->get('configs')->console_application->name);
$consoleApp->getHelperSet()->set(new \MiniFrame\ConsoleApplication\DiHelper($diImpl));
/**
 * Diğer komutları buradan ekleyebilirsiniz:
 *
 * $symfonyConsoleApp->add(new \Application\Console\MyCommand());
 */
/**
 * Doctrine ile ilgili komutlar özel olarak ekleniyor.
 */
$doctrineConn = \Doctrine\DBAL\DriverManager::getConnection(array('driver' => 'pdo_mysql', 'pdo' => $diImpl->get('pdo')));
$consoleApp->getHelperSet()->set(new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($doctrineConn));
$consoleApp->getHelperSet()->set(new \Symfony\Component\Console\Helper\DialogHelper(), 'dialog');
$consoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand());
$consoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand());
$consoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand());
$consoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand());
$consoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\LatestCommand());
$consoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand());
$consoleApp->add(new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand());
$consoleApp->run();
 public function bootCLI()
 {
     $app = $this;
     $app->register(new CommandServiceProvider());
     $app->boot();
     $application = new \Symfony\Component\Console\Application();
     $application->add($app['command.default']);
     // TODO add your other commands here
     $application->run();
 }
Пример #9
0
#!/usr/bin/env php
<?php 
if (file_exists(__DIR__ . '/../../autoload.php')) {
    require __DIR__ . '/../../autoload.php';
} else {
    require __DIR__ . '/vendor/autoload.php';
}
$app = new Symfony\Component\Console\Application('Jai', '1.0');
$app->add(new Jai\Installer\Console\NewInstaller());
$app->run();
Пример #10
0
#!/usr/bin/php
<?php 
@(include_once __DIR__ . '/../vendor/autoload.php') || @(include_once __DIR__ . '/../../../autoload.php');
use Symfony\Component\Console\Input\ArgvInput;
use Jerive\CsvTool\Command as Cmd;
$input = new ArgvInput();
$app = new Symfony\Component\Console\Application();
ini_set('auto_detect_line_endings', true);
$app->add(new Cmd\CutCommand());
$app->add(new Cmd\CallbackCommand());
$app->add(new Cmd\AppendCommand());
$app->add(new Cmd\MergeCommand());
$app->add(new Cmd\PadCommand());
$app->run(new ArgvInput());
Пример #11
0
<?php

/**
 * Per https://github.com/guzzle/guzzle/blob/master/docs/faq.rst
 * "Maximum function nesting level of '100' reached, aborting" is possible
 * This error message comes specifically from the XDebug extension.
 */
ini_set('xdebug.max_nesting_level', 1000);
// global variable to allow registering additional commands
// each callback should take a single parameter implementing ArrayAccess (the app config)
$GLOBALS['awwCommands'] = array();
if (file_exists(__DIR__ . '/../../autoload.php')) {
    // addwiki is part of a composer installation
    require_once __DIR__ . '/../../autoload.php';
} else {
    require_once __DIR__ . '/vendor/autoload.php';
}
$awwConfig = new Addwiki\Config\AppConfig(__DIR__);
$awwApp = new Symfony\Component\Console\Application('aww - addwiki cli tool');
$awwApp->addCommands(array(new Addwiki\Commands\Config\Setup($awwConfig), new Addwiki\Commands\Config\ConfigList($awwConfig), new Addwiki\Commands\Config\SetDefaultWiki($awwConfig), new Addwiki\Commands\Config\SetDefaultUser($awwConfig)));
foreach ($GLOBALS['awwCommands'] as $callback) {
    if (is_callable($callback)) {
        $awwApp->addCommands(call_user_func($callback, $awwConfig));
    }
}
$awwApp->run();
Пример #12
0
 public function run($args = array())
 {
     $defaults = array('proxy' => array('auto' => true, 'path' => LITHIUM_APP_PATH . '/resources/tmp/cache/Doctrine/Proxies', 'namespace' => 'Doctrine\\Proxies'), 'useModelDriver' => true, 'mapping' => array('class' => null, 'path' => LITHIUM_APP_PATH . '/models'), 'configuration' => null, 'eventManager' => null);
     if ($this->request->params['action'] != 'run') {
         $args = $this->request->argv;
     }
     // Check if we need to add the migration configuration file
     $migrationCommand = false;
     $migrationConfig = true;
     $migration = false;
     $conn = Connections::get($this->connection);
     $conn->_config = $conn->_config + $defaults;
     $i = 0;
     foreach ($args as &$arg) {
         if (strstr($arg, 'migrations:')) {
             $migrationCommand = true;
         }
         if (strstr($arg, 'migrations')) {
             $migration = true;
         }
         if (strstr($arg, '--configuration=')) {
             $migrationConfig = false;
         }
         if (strstr($arg, '--connection')) {
             unset($args[$i]);
         }
         $i++;
     }
     if ($migrationCommand && $migrationConfig) {
         $args[] = '--configuration=' . LITHIUM_APP_PATH . '/config/migrations.yml';
     }
     $input = new \Symfony\Component\Console\Input\ArgvInput($args);
     if (!$conn || !$conn instanceof \app\extensions\data\source\Doctrine) {
         $error = "Error: Could not get Doctrine proxy object from Connections, using";
         $error .= " configuration '{$this->connection}'. Please add the connection or choose";
         $error .= " an alternate configuration using the `--connection` flag.";
         $this->error($error);
         return;
     }
     /*
      * New Doctrine ORM Configuration
      * TODO: load multiple drivers [Annotations, YAML & XML]
      * 
      */
     $config = new \Doctrine\ORM\Configuration();
     $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
     //Annotation Driver
     $driver = $config->newDefaultAnnotationDriver(array(LITHIUM_APP_PATH . '/models'));
     $config->setMetadataDriverImpl($driver);
     //Proxy configuration
     $config->setProxyDir($conn->_config['proxy']['path']);
     $config->setProxyNamespace($conn->_config['proxy']['namespace']);
     //EntityManager
     $em = \Doctrine\ORM\EntityManager::create($conn->_config, $config);
     $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array('db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em), 'dialog' => new \Symfony\Component\Console\Helper\DialogHelper()));
     //CLI
     $cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', \Doctrine\Common\Version::VERSION);
     $cli->setCatchExceptions(true);
     $cli->register('doctrine');
     $cli->setHelperSet($helperSet);
     $cli->addCommands(array(new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(), new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(), new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(), new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand()));
     // If command called is a doctrine migration command
     if ($migration) {
         $cli->addCommands(array(new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand()));
     }
     $cli->run($input);
 }
Пример #13
0
#!/usr/bin/env php
<?php 
require_once __DIR__ . '/../autoload.php';
$app = new \Symfony\Component\Console\Application('lightsaml', '1.0');
$input = new \Symfony\Component\Console\Input\ArgvInput();
$app->add(new \LightSaml\Command\BuildSPMetadataCommand());
$app->run($input);
 public function run()
 {
     $application = new \Symfony\Component\Console\Application('Die Hard Quotes', '0.1.0-dev');
     $application->add($this->factory->getRandomQuoteCommand());
     $application->run();
 }
Пример #15
0
/**
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Markus Fischer <*****@*****.**>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
use Mfn\PHP\Analyzer\Console;
require_once __DIR__ . '/../bootstrap.php';
ini_set('memory_limit', -1);
$app = new \Symfony\Component\Console\Application();
$app->add(new Console\Analyze());
$app->add(new Console\Graphviz());
$returnCode = $app->run();
exit($returnCode);
Пример #16
0
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the LGPL. For more information, see
 * <http://www.doctrine-project.org>.
 */
Phar::mapPhar();
require_once 'phar://' . __FILE__ . '/Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\\Common', 'phar://' . __FILE__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\\DBAL', 'phar://' . __FILE__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'phar://' . __FILE__ . '/Doctrine');
$classLoader->register();
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array('dialog' => new \Symfony\Component\Console\Helper\DialogHelper()));
$cli = new \Symfony\Component\Console\Application('Doctrine Migrations', \Doctrine\DBAL\Migrations\MigrationsVersion::VERSION);
$cli->setCatchExceptions(true);
$cli->setHelperSet($helperSet);
$cli->addCommands(array(new \Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand()));
$input = file_exists('migrations-input.php') ? include 'migrations-input.php' : null;
$output = file_exists('migrations-output.php') ? include 'migrations-output.php' : null;
$cli->run($input, $output);
Пример #17
0
<?php

$application = new \Symfony\Component\Console\Application('SlimApi', '@package_version@');
$application->addCommands($container->get('commands'));
$application->run();
Пример #18
0
#!/usr/bin/env php
<?php 
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
    require_once __DIR__ . '/vendor/autoload.php';
} elseif (file_exists(__DIR__ . '/../../autoload.php')) {
    require_once __DIR__ . '/../../autoload.php';
} else {
    echo 'Gumdrop could not find dependencies' . PHP_EOL;
    exit(1);
}
$ConsoleApplication = new \Symfony\Component\Console\Application();
$ConsoleApplication->addCommands(array(new \Gumdrop\Commands\Generate(), new \Gumdrop\Commands\Install(), new \Gumdrop\Commands\Reload()));
$ConsoleApplication->run();
Пример #19
0
<?php

chdir('..');
require_once 'Doctrine/Common/ClassLoader.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
$classLoader->register();
//$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$configFile = 'bin/cli-config.php';
$helperSet = null;
if (file_exists($configFile)) {
    if (!is_readable($configFile)) {
        trigger_error('Configuration file [' . $configFile . '] does not have read permission.', E_ERROR);
    }
    require $configFile;
    foreach ($GLOBALS as $helperSetCandidate) {
        if ($helperSetCandidate instanceof \Symfony\Component\Console\Helper\HelperSet) {
            $helperSet = $helperSetCandidate;
            break;
        }
    }
}
$helperSet = $helperSet ?: new \Symfony\Component\Console\Helper\HelperSet();
$cli = new \Symfony\Component\Console\Application('Doctrine Command Line Interface', Doctrine\ORM\Version::VERSION);
$cli->setCatchExceptions(true);
$cli->setHelperSet($helperSet);
$cli->addCommands(array(new \Doctrine\DBAL\Tools\Console\Command\RunSqlCommand(), new \Doctrine\DBAL\Tools\Console\Command\ImportCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\MetadataCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand(), new \Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\UpdateCommand(), new \Doctrine\ORM\Tools\Console\Command\SchemaTool\DropCommand(), new \Doctrine\ORM\Tools\Console\Command\EnsureProductionSettingsCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertDoctrine1SchemaCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateRepositoriesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateEntitiesCommand(), new \Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand(), new \Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand(), new \Doctrine\ORM\Tools\Console\Command\RunDqlCommand(), new \Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand()));
$cli->run();
<?php

error_reporting(-1);
ini_set("display_errors", 1);
date_default_timezone_set('UTC');
$loader = (require __DIR__ . "/../vendor/autoload.php");
defined('ROOT_PATH') || define('ROOT_PATH', realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . '..');
defined('COMPOSER_HOME') || define('COMPOSER_HOME', ROOT_PATH . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'composer');
$cliApp = new \Symfony\Component\Console\Application('Amazon SWF discovering application', '1.0');
$cliApp->addCommands(array(new \Workflow\Commands\SWFDescribeWorkflowTypeCommand(), new \Workflow\Commands\SWFRespondTaskCompletedCommand(), new \Workflow\Commands\SWFStartPollingActivityCommand(), new \Workflow\Commands\SWFStartPollingDeciderCommand(), new \Workflow\Commands\SWFStartWorkflowCommand()));
$cliApp->run();