/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $task = new sfDoctrineDropDbTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $ret = $task->run(array(), array('no-confirmation' => $options['no-confirmation'])); if ($ret) { return $ret; } $task = new sfDoctrineBuildDbTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $ret = $task->run(); if ($ret) { return $ret; } $task = new sfDoctrineInsertSqlTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $ret = $task->run(); if ($ret) { return $ret; } if (count($options['and-load'])) { $task = new sfDoctrineDataLoadTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $ret = $task->run(array('dir_or_file' => in_array(array(), $options['and-load'], true) ? null : $options['and-load'])); if ($ret) { return $ret; } } }
public function loadFixtures($fixtures) { $path = sfConfig::get('sf_data_dir') . '/' . $fixtures; if (!file_exists($path)) { throw new sfException('Invalid data fixtures file'); } chdir(sfConfig::get('sf_root_dir')); $task = new sfDoctrineDataLoadTask($this->dispatcher, new sfFormatter()); $task->setConfiguration($this); $task->run(array($path)); }
protected function execute($arguments = array(), $options = array()) { // execute ./symfony doctrine:data-load $sfDoctrineDataLoadTask = new sfDoctrineDataLoadTask($this->dispatcher, $this->formatter); $sfDoctrineDataLoadTask->run($arguments = array('./plugins/opTimelinePlugin/data/fixtures/010_gadget_setting.yml'), $options = array('append')); // execute ./symfony plugin:publish-assets $sfPluginPublishAssetsTask = new sfPluginPublishAssetsTask($this->dispatcher, $this->formatter); $sfPluginPublishAssetsTask->run(); // execute ./symfomy cc $sfCacheClearTask = new sfCacheClearTask($this->dispatcher, $this->formatter); $sfCacheClearTask->run($arguments = array(), $options = array('type' => 'all')); }
<?php /** * This file is part of the OpenPNE package. * (c) OpenPNE Project (http://www.openpne.jp/) * * For the full copyright and license information, please view the LICENSE * file and the NOTICE file that were distributed with this source code. */ if (empty($_app)) { $_app = 'pc_frontend'; } $_env = 'test'; $configuration = ProjectConfiguration::getApplicationConfiguration($_app, $_env, true); new sfDatabaseManager($configuration); try { if (3 > (int) Doctrine::getTable('SnsConfig')->get('opDiaryPlugin_test_revision')) { throw new Exception(); } } catch (Exception $e) { $task = new sfDoctrineBuildTask($configuration->getEventDispatcher(), new sfFormatter()); $task->setConfiguration($configuration); $task->run(array(), array('no-confirmation' => true, 'db' => true, 'and-load' => false, 'application' => $_app, 'env' => $_env)); $task = new sfDoctrineDataLoadTask($configuration->getEventDispatcher(), new sfFormatter()); $task->setConfiguration($configuration); $task->run(array(dirname(__FILE__) . '/../../../../data/fixtures/010_import_sns_terms.yml', dirname(__FILE__) . '/../../../../data/fixtures/003_import_admin_user.yml', dirname(__FILE__) . '/../fixtures')); }
<?php /** * This file is part of the OpenPNE package. * (c) OpenPNE Project (http://www.openpne.jp/) * * For the full copyright and license information, please view the LICENSE * file and the NOTICE file that were distributed with this source code. */ if (empty($_app)) { $_app = 'pc_backend'; } $_env = 'test'; $configuration = ProjectConfiguration::getApplicationConfiguration($_app, $_env, true); new sfDatabaseManager($configuration); $task = new sfDoctrineBuildTask($configuration->getEventDispatcher(), new sfFormatter()); $task->setConfiguration($configuration); $task->run(array(), array('no-confirmation' => true, 'db' => true, 'and-load' => true, 'application' => $_app, 'env' => $_env)); $task = new sfDoctrineDataLoadTask($configuration->getEventDispatcher(), new sfFormatter()); $task->setConfiguration($configuration); $task->run(dirname(__FILE__) . '/../fixtures'); $conn = Doctrine_Manager::getInstance()->getCurrentConnection(); $conn->clear();
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { if (!($mode = $this->calculateMode($options))) { throw new InvalidArgumentException(sprintf("You must include one or more of the following build options:\n--%s\n\nSee this task's help page for more information:\n\n php symfony help doctrine:build", join(', --', array_keys($this->getBuildOptions())))); } if (self::BUILD_DB == (self::BUILD_DB & $mode)) { $task = new sfDoctrineDropDbTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $ret = $task->run(array(), array('no-confirmation' => $options['no-confirmation'])); if ($ret) { return $ret; } $task = new sfDoctrineBuildDbTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $ret = $task->run(); if ($ret) { return $ret; } // :insert-sql (or :migrate) will also be run, below } if (self::BUILD_MODEL == (self::BUILD_MODEL & $mode)) { $task = new dinDoctrineBuildModelTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $ret = $task->run(); if ($ret) { return $ret; } } if (self::BUILD_FORMS == (self::BUILD_FORMS & $mode)) { $task = new dinDoctrineBuildFormsTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $ret = $task->run(); if ($ret) { return $ret; } } if (self::BUILD_FILTERS == (self::BUILD_FILTERS & $mode)) { $task = new dinDoctrineBuildFiltersTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $ret = $task->run(); if ($ret) { return $ret; } } if (self::BUILD_SQL == (self::BUILD_SQL & $mode)) { $task = new sfDoctrineBuildSqlTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $ret = $task->run(); if ($ret) { return $ret; } } if ($options['and-migrate']) { $task = new sfDoctrineMigrateTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $ret = $task->run(); if ($ret) { return $ret; } } else { if (self::BUILD_DB == (self::BUILD_DB & $mode)) { $task = new sfDoctrineInsertSqlTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $ret = $task->run(); if ($ret) { return $ret; } } } if (count($options['and-load']) || count($options['and-append'])) { $task = new sfDoctrineDataLoadTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); if (count($options['and-load'])) { $ret = $task->run(array('dir_or_file' => in_array(array(), $options['and-load'], true) ? null : $options['and-load'])); if ($ret) { return $ret; } } if (count($options['and-append'])) { $ret = $task->run(array('dir_or_file' => in_array(array(), $options['and-append'], true) ? null : $options['and-append']), array('append' => true)); if ($ret) { return $ret; } } } }
<?php /* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ // guess current application if (!isset($app)) { $traces = debug_backtrace(); $caller = $traces[0]; $dirPieces = explode(DIRECTORY_SEPARATOR, dirname($caller['file'])); $app = array_pop($dirPieces); } require_once dirname(__FILE__) . '/../../config/ProjectConfiguration.class.php'; $configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); sfContext::createInstance($configuration); // remove all cache sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir')); // load data $dispatcher = $configuration->getEventDispatcher(); $formatter = new sfFormatter(); $task = new sfDoctrineDataLoadTask($dispatcher, $formatter); $ret = $task->run(); if ($ret) { return $ret; }
protected function initDb($tmpdir) { $task = new sfDoctrineBuildSqlTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $task->run(); $task = new sfDoctrineInsertSqlTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $task->run(); $task = new sfDoctrineDataLoadTask($this->dispatcher, $this->formatter); $task->setCommandApplication($this->commandApplication); $task->setConfiguration($this->configuration); $task->run(array('dir_or_file' => $tmpdir)); }
protected function _loadData($append = true) { sfConfig::set('sf_app', $this->_application); $task = new sfDoctrineDataLoadTask($this->_dispatcher, $this->_formatter); $fixtures = $this->_getDataFixtures(); if (!is_array($fixtures)) { $fixtures = array(); } $task->run($fixtures, array('append' => $append, 'application' => $this->_application)); }
<?php if (!isset($prefix)) { $prefix = ''; } if (!isset($app)) { $app = 'pc_frontend'; } $configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true); new sfDatabaseManager($configuration); $task = new sfDoctrineBuildTask($configuration->getEventDispatcher(), new sfFormatter()); $task->setConfiguration($configuration); $task->run(array(), array('no-confirmation' => true, 'db' => true, 'and-load' => true, 'application' => $app, 'env' => 'test')); $task = new sfDoctrineDataLoadTask($configuration->getEventDispatcher(), new sfFormatter()); $task->setConfiguration($configuration); $task->run(dirname(__FILE__) . '/../fixtures' . $prefix);
/** * Loads the project data */ protected function _loadData($append = false) { sfConfig::set('sf_app', $this->_application); $task = new sfDoctrineDataLoadTask($this->_dispatcher, $this->_formatter); $this->logTaskCall('data', 'Loading fixture data', sprintf('doctrine:data-load --append --application=%s)', $this->_application)); $this->_disableOutput(); $task->run(array(), array('append' => $append, 'application' => $this->_application)); $this->_enableOutput(); $this->logSection('data', '...finished loading fixture data'); }