/** * @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; } } }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $dropDb = new sfDoctrineDropDbTask($this->dispatcher, $this->formatter); $dropDb->setCommandApplication($this->commandApplication); $dropDbOptions = array(); $dropDbOptions[] = '--env=' . $options['env']; if (isset($options['no-confirmation']) && $options['no-confirmation']) { $dropDbOptions[] = '--no-confirmation'; } if (isset($options['application']) && $options['application']) { $dropDbOptions[] = '--application=' . $options['application']; } $dropDb->run(array(), $dropDbOptions); $buildAllLoad = new sfDoctrineBuildAllLoadTask($this->dispatcher, $this->formatter); $buildAllLoad->setCommandApplication($this->commandApplication); $buildAllLoadOptions = array(); $buildAllLoadOptions[] = '--env=' . $options['env']; if (!empty($options['dir'])) { $buildAllLoadOptions[] = '--dir=' . implode(' --dir=', $options['dir']); } if (isset($options['append']) && $options['append']) { $buildAllLoadOptions[] = '--append'; } if (isset($options['application']) && $options['application']) { $buildAllLoadOptions[] = '--application=' . $options['application']; } if (isset($options['skip-forms']) && $options['skip-forms']) { $buildAllLoadOptions[] = '--skip-forms'; } $buildAllLoad->run(array(), $buildAllLoadOptions); }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $baseOptions = $this->configuration instanceof sfApplicationConfiguration ? array('--application=' . $this->configuration->getApplication(), '--env=' . $options['env']) : array(); $dropDbOptions = $baseOptions; if (isset($options['no-confirmation']) && $options['no-confirmation']) { $dropDbOptions[] = '--no-confirmation'; } $dropDb = new sfDoctrineDropDbTask($this->dispatcher, $this->formatter); $dropDb->setCommandApplication($this->commandApplication); $dropDb->run(array(), $dropDbOptions); $buildAll = new sfDoctrineBuildAllTask($this->dispatcher, $this->formatter); $buildAll->setCommandApplication($this->commandApplication); $buildAll->run(array(), $baseOptions); }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $dropDb = new sfDoctrineDropDbTask($this->dispatcher, $this->formatter); $dropDb->setCommandApplication($this->commandApplication); $dropDbOptions = array(); $dropDbOptions[] = '--env=' . $options['env']; if (isset($options['force']) && $options['force']) { $dropDbOptions[] = '--force'; } $dropDb->run(array('application' => $arguments['application']), $dropDbOptions); $buildAll = new sfDoctrineBuildAllTask($this->dispatcher, $this->formatter); $buildAll->setCommandApplication($this->commandApplication); $buildAll->run(array('application' => $arguments['application']), array('--env=' . $options['env'])); }
/** * @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; } } } }