当前位置: 首页>>代码示例>>PHP>>正文


PHP ConsoleRunner::addCommands方法代码示例

本文整理汇总了PHP中Doctrine\ORM\Tools\Console\ConsoleRunner::addCommands方法的典型用法代码示例。如果您正苦于以下问题:PHP ConsoleRunner::addCommands方法的具体用法?PHP ConsoleRunner::addCommands怎么用?PHP ConsoleRunner::addCommands使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\ORM\Tools\Console\ConsoleRunner的用法示例。


在下文中一共展示了ConsoleRunner::addCommands方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onBootstrap

 /**
  * {@inheritDoc}
  */
 public function onBootstrap(EventInterface $e)
 {
     /* @var $app \Zend\Mvc\ApplicationInterface */
     $app = $e->getTarget();
     $events = $app->getEventManager()->getSharedManager();
     // Attach to helper set event and load the entity manager helper.
     $events->attach('doctrine', 'loadCli.post', function (EventInterface $e) {
         /* @var $cli \Symfony\Component\Console\Application */
         $cli = $e->getTarget();
         ConsoleRunner::addCommands($cli);
         $cli->addCommands(array(new DiffCommand(), new ExecuteCommand(), new GenerateCommand(), new MigrateCommand(), new StatusCommand(), new VersionCommand()));
         /* @var $sm ServiceLocatorInterface */
         $sm = $e->getParam('ServiceManager');
         /* @var $em \Doctrine\ORM\EntityManager */
         $em = $sm->get('doctrine.entitymanager.orm_default');
         $helperSet = $cli->getHelperSet();
         $helperSet->set(new DialogHelper(), 'dialog');
         $helperSet->set(new ConnectionHelper($em->getConnection()), 'db');
         $helperSet->set(new EntityManagerHelper($em), 'em');
     });
     $config = $app->getServiceManager()->get('Config');
     $app->getServiceManager()->get('doctrine.entity_resolver.orm_default');
     if (isset($config['zenddevelopertools']['profiler']['enabled']) && $config['zenddevelopertools']['profiler']['enabled']) {
         $app->getServiceManager()->get('doctrine.sql_logger_collector.orm_default');
     }
 }
开发者ID:ramonjmz,项目名称:cursozf2,代码行数:29,代码来源:Module.php

示例2: __construct

 /**
  * Constructor
  *
  * @param Application $console Console
  * @param ContainerInterface $container Container DI
  */
 public function __construct(Application $console, ContainerInterface $container)
 {
     $entityManager = $container->get('EntityManager');
     $helperSet = ConsoleRunner::createHelperSet($entityManager);
     $helperSet->set(new QuestionHelper(), 'dialog');
     $console->setHelperSet($helperSet);
     ConsoleRunner::addCommands($console);
 }
开发者ID:danielspk,项目名称:tornadohttpskeletonapplication,代码行数:14,代码来源:ORMRegister.php

示例3: registerCommands

 public function registerCommands(Application $application)
 {
     parent::registerCommands($application);
     //include Doctrine ORM commands if exist
     if (class_exists('Doctrine\\ORM\\Version')) {
         ConsoleRunner::addCommands($application);
     }
 }
开发者ID:skillberto,项目名称:ConsoleExtendBundle,代码行数:8,代码来源:SkillbertoConsoleExtendBundle.php

示例4: run

 /**
  * Run console with the given helperset.  Use the in-built Doctrine commands, plus Flextrine specific ones.
  *
  * @param \Symfony\Component\Console\Helper\HelperSet $helperSet
  * @return void
  */
 public static function run(HelperSet $helperSet)
 {
     $cli = new Application('Doctrine Command Line Interface', \Doctrine\ORM\Version::VERSION);
     $cli->setCatchExceptions(true);
     $cli->setHelperSet($helperSet);
     parent::addCommands($cli);
     self::addCommands($cli);
     $cli->run();
 }
开发者ID:gomestai,项目名称:flextrine,代码行数:15,代码来源:ConsoleRunner.php

示例5: __construct

 public function __construct()
 {
     parent::__construct(static::NAME, static::VERSION);
     //Add Doctrine support to console
     $em = Configuration::getEntityManager();
     $doctrineHelperSet = new HelperSet(['db' => new ConnectionHelper($em->getConnection()), 'em' => new EntityManagerHelper($em)]);
     $this->setHelperSet($doctrineHelperSet);
     ConsoleRunner::addCommands($this);
     $this->addCommands([new Command\ModuleUpdateCommand()]);
 }
开发者ID:adamjakab,项目名称:D8ModScan,代码行数:10,代码来源:Application.php

示例6: ormCommands

 /**
  * @param $orm
  */
 public function ormCommands($orm)
 {
     if (is_array($orm) && in_array('doctrine', $orm)) {
         /** @var EntityManager $em */
         $em = Model::orm('doctrine')->getOrm();
         $helperSet = ConsoleRunner::createHelperSet($em);
         $this->cli->setCatchExceptions(true);
         $this->cli->setHelperSet($helperSet);
         ConsoleRunner::addCommands($this->cli);
     }
 }
开发者ID:jetfirephp,项目名称:framework,代码行数:14,代码来源:ConsoleProvider.php

示例7: setupDoctrineCommands

 public function setupDoctrineCommands()
 {
     if (!Core::make('app')->isInstalled()) {
         return;
     }
     $helperSet = ConsoleRunner::createHelperSet(\ORM::entityManager('core'));
     $this->setHelperSet($helperSet);
     $migrationsConfiguration = new MigrationsConfiguration();
     /** @var \Doctrine\DBAL\Migrations\Tools\Console\Command\AbstractCommand[] $commands */
     $commands = 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());
     foreach ($commands as $migrationsCommand) {
         $migrationsCommand->setMigrationConfiguration($migrationsConfiguration);
         $this->add($migrationsCommand);
     }
     ConsoleRunner::addCommands($this);
 }
开发者ID:kreativmind,项目名称:concrete5-5.7.0,代码行数:16,代码来源:Application.php

示例8: init

 /**
  * {@inheritDoc}
  */
 public function init(ModuleManager $e)
 {
     $events = $e->getEventManager()->getSharedManager();
     // Attach to helper set event and load the entity manager helper.
     $events->attach('doctrine', 'loadCli.post', function (EventInterface $e) {
         /* @var $cli \Symfony\Component\Console\Application */
         $cli = $e->getTarget();
         /* @var $sm ServiceLocatorInterface */
         $sm = $e->getParam('ServiceManager');
         $em = $sm->get('doctrine.entitymanager.orm_default');
         $paths = $sm->get('doctrine.configuration.fixtures');
         $importCommand = new ImportCommand();
         $importCommand->setEntityManager($em);
         $importCommand->setPath($paths);
         ConsoleRunner::addCommands($cli);
         $cli->addCommands(array($importCommand));
     });
 }
开发者ID:oscar121,项目名称:doggerout,代码行数:21,代码来源:Module.php

示例9: onBootstrap

 public function onBootstrap(EventInterface $e)
 {
     $app = $e->getTarget();
     $events = $app->getEventManager()->getSharedManager();
     // Attach to helper set event and load the entity manager helper.
     $events->attach('doctrine', 'loadCli.post', function (EventInterface $e) {
         $cli = $e->getTarget();
         ConsoleRunner::addCommands($cli);
         if (class_exists('Doctrine\\DBAL\\Migrations\\Versions')) {
             $cli->add(array(new DiffCommand(), new ExecuteCommand(), new GenerateCommand(), new MigrateCommand(), new StatusCommand(), new VersionCommand()));
         }
         $sm = $e->getParam('ServiceManager');
         $em = $sm->get('doctrine.entitymanager.orm_another');
         $helperSet = $cli->getHelperSet();
         $helperSet->set(new DialogHelper(), 'dialog');
         $helperSet->set(new ConnectionHelper($em->getConnection()), 'db');
         $helperSet->set(new EntityManagerHelper($em), 'em');
     });
 }
开发者ID:89snake89,项目名称:PHPTest,代码行数:19,代码来源:Module.php

示例10: addOrmCommands

 /**
  * Add Doctrine commands
  *
  * @return $this
  */
 public function addOrmCommands()
 {
     ConsoleRunner::addCommands($this);
     return $this;
 }
开发者ID:myovchev,项目名称:zaralab-api,代码行数:10,代码来源:App.php

示例11: SilexApplication

use Symfony\Component\Console\Helper\HelperSet;
use Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper;
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use MJanssen\Command\CacheClearCommand;
use MJanssen\Command\DocsCreateCommand;
use MJanssen\Command\LogClearCommand;
chdir(dirname(__DIR__));
$loader = (require_once 'vendor/autoload.php');
set_time_limit(0);
$app = new SilexApplication();
$cli = true;
require_once 'app/bootstrap.php';
$console = new ConsoleApplication('Silex - Rest API Edition', '1.0');
$console->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', 'dev'));
$command = new CacheClearCommand();
$command->setCachePath($app['cache.path']);
$console->add($command);
$command = new LogClearCommand();
$command->setLogPath($app['log.path']);
$console->add($command);
$command = new DocsCreateCommand();
$command->setApplicationPath($app['app.path']);
$console->add($command);
/*
 * Doctrine CLI
 */
$helperSet = new HelperSet(array('db' => new ConnectionHelper($app['orm.em']->getConnection()), 'em' => new EntityManagerHelper($app['orm.em'])));
$console->setHelperSet($helperSet);
ConsoleRunner::addCommands($console);
$console->run();
开发者ID:roman-pavlyshyn,项目名称:silex-rest-api,代码行数:31,代码来源:console.php

示例12: registerCommands

 /**
  * @param OutputInterface $output
  */
 protected function registerCommands(OutputInterface $output)
 {
     //Wrap database related logic in a try-catch
     //so that non-db commands can still execute
     try {
         $em = $this->kernel->getContainer()->get('models');
         // setup doctrine commands
         $helperSet = $this->getHelperSet();
         $helperSet->set(new EntityManagerHelper($em), 'em');
         $helperSet->set(new ConnectionHelper($em->getConnection()), 'db');
         DoctrineConsoleRunner::addCommands($this);
         $this->registerEventCommands();
     } catch (\Exception $e) {
         $formatter = $this->getHelperSet()->get('formatter');
         $output->writeln($formatter->formatBlock('WARNING! ' . $e->getMessage() . " in " . $e->getFile(), 'error'));
     }
     $this->registerFilesystemCommands();
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:21,代码来源:Application.php

示例13: HelperSet

        case 'yml':
        case 'yaml':
            //$driver = new YamlDriver( $mappingPaths );
            //$driver->setFileExtension('.yml');
            $ymlConfig = Setup::createYAMLMetadataConfiguration($mappingPaths, $env == 'dev');
            //$ymlConfig->setMetadataDriverImpl( $driver );
            $entityManager = EntityManager::create($dbParams, $ymlConfig);
            break;
        case 'annotation':
            $annotationConfig = Setup::createAnnotationMetadataConfiguration($mappingPaths, $env == 'dev');
            $entityManager = EntityManager::create($dbParams, $annotationConfig);
            break;
        default:
            throw new \Exception("Config: Unknown mapping type of '{$mappingType}'.");
    }
    if (empty($entityManager)) {
        throw new \Exception("Config: Unable to instantiate an entity manager. Please check the configuration.");
    }
    $helperSet = new HelperSet(array('db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($entityManager->getConnection()), 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($entityManager)));
    $app = new DoctrineConsole();
    $app->setCatchExceptions(false);
    $app->setDispatcher($dispatcher);
    $app->setHelperSet($helperSet);
    ConsoleRunner::addCommands($app);
    $commands = 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\LatestCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand(), new \Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand());
    $app->addCommands($commands);
    $app->run();
} catch (\Exception $e) {
    $output = new \Symfony\Component\Console\Output\ConsoleOutput();
    $app->renderException($e, $output->getErrorOutput());
}
开发者ID:northern,项目名称:DoctrineConsole,代码行数:31,代码来源:doctrine.php

示例14: runConsole

 /**
  * @return RZ\Roadiz\Core\Kernel $this
  */
 public function runConsole()
 {
     /*
      * Define a request wide timezone
      */
     if (!empty($this->container['config']["timezone"])) {
         date_default_timezone_set($this->container['config']["timezone"]);
     } else {
         date_default_timezone_set("Europe/Paris");
     }
     $application = new Application('Roadiz Console Application', static::$cmsVersion);
     $helperSet = new HelperSet(['configuration' => new ConfigurationHelper($this->container['config']), 'db' => new ConnectionHelper($this->container['em']->getConnection()), 'em' => new EntityManagerHelper($this->container['em']), 'question' => new QuestionHelper(), 'solr' => new SolrHelper($this->container['solr']), 'ns-cache' => new CacheProviderHelper($this->container['nodesSourcesUrlCacheProvider']), 'mailer' => new MailerHelper($this->container['mailer']), 'templating' => new TemplatingHelper($this->container['twig.environment']), 'translator' => new TranslatorHelper($this->container['translator'])]);
     $application->setHelperSet($helperSet);
     $application->add(new \RZ\Roadiz\Console\TranslationsCommand());
     $application->add(new \RZ\Roadiz\Console\NodeTypesCommand());
     $application->add(new \RZ\Roadiz\Console\NodesSourcesCommand());
     $application->add(new \RZ\Roadiz\Console\NodesCommand());
     $application->add(new \RZ\Roadiz\Console\ThemesCommand());
     $application->add(new \RZ\Roadiz\Console\InstallCommand());
     $application->add(new \RZ\Roadiz\Console\UsersCommand());
     $application->add(new \RZ\Roadiz\Console\RequirementsCommand());
     $application->add(new \RZ\Roadiz\Console\SolrCommand());
     $application->add(new \RZ\Roadiz\Console\CacheCommand());
     $application->add(new \RZ\Roadiz\Console\ConfigurationCommand());
     $application->add(new \RZ\Roadiz\Console\ThemeInstallCommand());
     $application->add(new \RZ\Roadiz\Console\DocumentDownscaleCommand());
     /*
      * Register user defined Commands
      * Add them in your config.yml
      */
     if (isset($this->container['config']['additionalCommands'])) {
         foreach ($this->container['config']['additionalCommands'] as $commandClass) {
             if (class_exists($commandClass)) {
                 $application->add(new $commandClass());
             } else {
                 throw new \Exception("Command class does not exists (" . $commandClass . ")", 1);
             }
         }
     }
     // Use default Doctrine commands
     ConsoleRunner::addCommands($application);
     $application->run();
     $this->container['stopwatch']->stop('global');
     return $this;
 }
开发者ID:QuangDang212,项目名称:roadiz,代码行数:48,代码来源:Kernel.php

示例15: registerCommands

 protected function registerCommands()
 {
     //Wrap database related logic in a try-catch
     //so that non-db commands can still execute
     try {
         $em = $this->kernel->getContainer()->get('models');
         // setup doctrine commands
         $helperSet = $this->getHelperSet();
         $helperSet->set(new EntityManagerHelper($em), 'em');
         $helperSet->set(new ConnectionHelper($em->getConnection()), 'db');
         DoctrineConsoleRunner::addCommands($this);
         $this->registerEventCommands();
     } catch (\Exception $e) {
     }
     $this->registerFilesystemCommands();
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:16,代码来源:Application.php


注:本文中的Doctrine\ORM\Tools\Console\ConsoleRunner::addCommands方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。