當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ConsoleRunner::createHelperSet方法代碼示例

本文整理匯總了PHP中Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet方法的典型用法代碼示例。如果您正苦於以下問題:PHP ConsoleRunner::createHelperSet方法的具體用法?PHP ConsoleRunner::createHelperSet怎麽用?PHP ConsoleRunner::createHelperSet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\ORM\Tools\Console\ConsoleRunner的用法示例。


在下文中一共展示了ConsoleRunner::createHelperSet方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __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

示例2: doRun

 /**
  * {@inheritDoc}
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $this->setHelperSet(ConsoleRunner::createHelperSet($this->app->get('doctrine.orm.entity_manager')));
     $this->getHelperSet()->set(new QuestionHelper());
     $this->getHelperSet()->set(new DialogHelper());
     $this->registerCommands();
     $this->io = new ConsoleIO($input, $output, $this->getHelperSet());
     return parent::doRun($input, $output);
 }
開發者ID:Bonscho,項目名稱:packages,代碼行數:12,代碼來源:Application.php

示例3: registerEntityManager

 private function registerEntityManager(Application $app, $serviceName, Connection $connection, Configuration $metadataConfig)
 {
     $app[$serviceName] = $app->share(function () use($app, $connection, $metadataConfig) {
         return EntityManager::create($connection, $metadataConfig);
     });
     // create a console for every manager
     $consoleServiceName = sprintf('%s.console', $serviceName);
     $app[$consoleServiceName] = $app->share(function () use($app, $serviceName) {
         return ConsoleRunner::createApplication(ConsoleRunner::createHelperSet($app[$serviceName]));
     });
 }
開發者ID:everlution,項目名稱:silex-doctrine-orm-service,代碼行數:11,代碼來源:SilexDoctrineOrmServiceProvider.php

示例4: 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

示例5: _before

 protected function _before()
 {
     $credentials = new DbCredentials();
     $container = ContainerService::getInstance()->setDbCredentials($credentials)->addEntityPath('src/Entity')->getContainer();
     $em = $container['doctrine.entity_manager'];
     $helperSet = ConsoleRunner::createHelperSet($em);
     $helperSet->set(new DialogHelper(), 'dialog');
     $this->app = new Application();
     $gen = new GenerateProxy();
     $gen->setHelperSet($helperSet);
     $this->app->add($gen);
     $this->app->add(new VersionCommand());
 }
開發者ID:delboy1978uk,項目名稱:common,代碼行數:13,代碼來源:GenerateProxiesTest.php

示例6: _before

 protected function _before()
 {
     $credentials = new DbCredentials();
     $container = ContainerService::getInstance()->setDbCredentials($credentials)->addEntityPath('src/Entity')->getContainer();
     $em = $container['doctrine.entity_manager'];
     $helperSet = ConsoleRunner::createHelperSet($em);
     $helperSet->set(new DialogHelper(), 'dialog');
     $configuration = new Configuration($em->getConnection());
     $configuration->setMigrationsNamespace('Migrations');
     $configuration->setMigrationsTableName('Migration');
     $this->app = new Application();
     $mig = new Migration();
     $mig->setMigrationConfiguration($configuration);
     $this->app->add($mig);
     $this->app->add(new VersionCommand());
 }
開發者ID:delboy1978uk,項目名稱:common,代碼行數:16,代碼來源:MigrationTest.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: indexAction

 public function indexAction()
 {
     if ($this->getRequest() instanceof ConsoleRequest) {
         $params = $this->params()->fromRoute();
         switch ($params['api']) {
             case 'doctrine':
                 global $argv;
                 array_shift($argv);
                 // index.php
                 array_shift($argv);
                 // external
                 $_SERVER['argv'] = $argv;
                 $helperSet = ConsoleRunner::createHelperSet($this->getServiceLocator()->get('Doctrine\\ORM\\EntityManager'));
                 ConsoleRunner::run($helperSet, array());
                 break;
             default:
                 return 'Could not find an option for external tool: ' . $params['api'];
         }
         return '';
     }
     return new ViewModel();
 }
開發者ID:athemcms,項目名稱:athcore,代碼行數:22,代碼來源:IndexController.php

示例9: actionIndex

 public function actionIndex()
 {
     unset($_SERVER['argv'][1]);
     $option = '--' . \yii\console\Application::OPTION_APPCONFIG . '=';
     foreach ($_SERVER['argv'] as $key => $param) {
         if (strpos($param, $option) === 0) {
             $keyToUnset = $key;
             break;
         }
     }
     if (isset($keyToUnset)) {
         unset($_SERVER['argv'][$keyToUnset]);
         unset($keyToUnset);
     }
     // Currently, symfony application uses a deprecated class (DialogHelper).
     // Don't throw an exception.
     $currentLevel = error_reporting();
     error_reporting($currentLevel ^ E_USER_DEPRECATED);
     $doctrine = $this->getDoctrineComponent();
     $entityManager = $doctrine->getEntityManager();
     $helperSet = ConsoleRunner::createHelperSet($entityManager);
     $result = ConsoleRunner::run($helperSet);
     return $result;
 }
開發者ID:iw-reload,項目名稱:iw,代碼行數:24,代碼來源:DoctrineController.php

示例10: dirname

<?php

require dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
use Doctrine\ORM\Tools\Console\ConsoleRunner;
//create database if not exists
$mysqlConfig = NwApi\Libraries\Config::getInstance('mysql');
$mysqli = new mysqli($mysqlConfig->host, $mysqlConfig->user, $mysqlConfig->password, '', $mysqlConfig->port);
if (!$mysqli->query('CREATE DATABASE IF NOT EXISTS ' . $mysqli->real_escape_string($mysqlConfig->database))) {
    throw new Exception('Unable to create database');
}
return ConsoleRunner::createHelperSet(NwApi\Di::getInstance()->em);
開發者ID:petitchevalroux,項目名稱:newswatcher-api,代碼行數:11,代碼來源:cli-config.php

示例11: EntityManager

<?php

require_once __DIR__ . '/../bootstrap.php';
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Nucleus\Config;
use Nucleus\EntityManager;
return ConsoleRunner::createHelperSet((new EntityManager(new Config()))->getEntityManager());
開發者ID:NucleusFramework,項目名稱:Nucleus,代碼行數:7,代碼來源:cli-config.php

示例12:

<?php

require_once "bootstrap.php";
return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($container->get('entityManager'));
開發者ID:destebang,項目名稱:taskreporter-1,代碼行數:4,代碼來源:cli-config.php

示例13:

<?php

require_once "bootstrap.php";
$sm = \Updashd\ServiceManager::getInstance();
return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($sm->get('\\Updashd\\Service\\Doctrine\\EntityManagerService')->getEntityManager());
開發者ID:updashd,項目名稱:updashd-api-provider,代碼行數:5,代碼來源:cli-config.php

示例14:

<?php

$entityManager = (require __DIR__ . '/../bootstrap.php');
return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($entityManager);
開發者ID:OaSiis,項目名稱:EasyEticket,代碼行數:4,代碼來源:cli-config.php

示例15:

<?php

require_once __DIR__ . '/vendor/autoload.php';
$app = new Domora\TvGuide\Application();
\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader('class_exists');
return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($app['orm.em']);
開發者ID:nawrasg,項目名稱:tvguide,代碼行數:6,代碼來源:cli-config.php


注:本文中的Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。