protected function execute($arguments = array(), $options = array()) { $doctrineManager = Doctrine_Manager::getInstance(); $databaseManager = new sfDatabaseManager($this->configuration); $conn = $doctrineManager->openConnection($databaseManager->getDatabase('main')->getParameter('dsn'), 'main'); Doctrine::dropDatabases('main'); }
public function tearDown() { try { Doctrine::dropDatabases(); Util_Log::get()->UnitTests()->debug('Executed TearDown'); } catch (Exception $e) { Util_Log::get()->UnitTests()->err($e->getMessage()); } }
public function doctrineAction() { $options = array('phpDocPackage' => 'Kromatick', 'phpDocSubpackage' => 'Intermodels', 'phpDocName' => 'Neozeratul', 'phpDocEmail' => '*****@*****.**'); Doctrine::dropDatabases(); Doctrine::createDatabases(); Doctrine::generateModelsFromYaml(APPLICATION_PATH . "/data/schema/schema.yml", APPLICATION_PATH . "/models", $options); Doctrine::createTablesFromModels(); //Doctrine::loadData($yamlPath, $append): echo Doctrine::generateSqlFromModels(); $this->render('index'); }
public function setUp() { $manager = Doctrine_Manager::getInstance(); foreach ($manager as $conn) { $modelsPath = APPLICATION_PATH . '/models'; $fixturesPath = APPLICATION_PATH . '/../doctrine/data/fixtures'; $name = array($conn->getName()); Doctrine::dropDatabases($name); Doctrine::createDatabases($name); Doctrine::createTablesFromModels($modelsPath); Doctrine::loadData($fixturesPath, true); } }
public function execute() { $answer = $this->ask('Are you sure you wish to drop your databases? (y/n)'); if ($answer != 'y') { $this->notify('Successfully cancelled'); return; } $results = Doctrine::dropDatabases(); foreach ($results as $dbName => $bool) { $msg = $bool ? 'Successfully dropped database named: "' . $dbName . '"' : 'Could not drop database named: "' . $dbName . '"'; $this->notify($msg); } }
public function execute() { if (!$this->getArgument('force')) { $answer = $this->ask('Are you sure you wish to drop your databases? (y/n)'); if ($answer != 'y') { $this->notify('Successfully cancelled'); return; } } $results = Doctrine::dropDatabases(); foreach ($results as $name => $result) { $msg = $result instanceof Exception ? 'Could not drop database for connection: "' . $name . '." Failed with exception: ' . $result->getMessage() : $result; $this->notify($msg); } }
<?php define("CLASSPATH", realpath(dirname(__FILE__) . "/../..")); define("DOCTRINE_FOLDER", CLASSPATH . "/3rdParty/Doctrine-1.1.0/lib"); define("MODELS_FOLDER", CLASSPATH . "/models/data_objects"); define("YML_FOLDER", CLASSPATH . "/models/yml"); require_once DOCTRINE_FOLDER . '/Doctrine.php'; require_once CLASSPATH . '/config/db.conf.php'; spl_autoload_register(array('Doctrine', 'autoload')); $manager = Doctrine_Manager::getInstance(); $conn = Doctrine_Manager::connection("{$db_conn_type}://{$db_user}:{$db_pass}@{$db_host}/{$db_name}", 'doctrine'); $manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE); $conn->setAttribute(Doctrine::ATTR_USE_NATIVE_ENUM, true); Doctrine::dropDatabases(); Doctrine::createDatabases(); Doctrine::generateModelsFromYaml(YML_FOLDER . '/db.yml', MODELS_FOLDER); Doctrine::createTablesFromModels(MODELS_FOLDER);
public function dropDB() { Doctrine::dropDatabases(self::DB_NAME); }