コード例 #1
0
/**
 * Create Database Tables from Models
 */
function doctrine_create_database()
{
    if (count(scandir(MODELS_DIRECTORY)) == 2) {
        doctrine_create_models();
    }
    Doctrine::createTablesFromModels(MODELS_DIRECTORY);
}
コード例 #2
0
 protected function createTables()
 {
     try {
         Doctrine::createTablesFromModels(array($this->modelPath));
     } catch (Doctrine_Exception $e) {
         echo "Error during schema creation - are you sure the table doesn't already exist? If so, use the update command.\n\n" . $e->getMessage();
     }
 }
コード例 #3
0
    function create_tables()
    {
        echo 'Reminder: Make sure the tables do not exist already.<br />
		<form action="" method="POST">
		<input type="submit" name="action" value="Create Tables"><br /><br />';
        if ($this->input->post('action')) {
            Doctrine::createTablesFromModels();
            echo "Done!";
        }
    }
コード例 #4
0
 /**
  * Main entry point for task
  */
 public function main()
 {
     $manager = Doctrine_Manager::getInstance();
     // Set up validation
     $manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL);
     $conn = Doctrine_Manager::connection($this->_dsn->_toString());
     $conn->setAttribute('portability', Doctrine::PORTABILITY_ALL);
     $conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true);
     Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_AGGRESSIVE);
     Doctrine::createTablesFromModels($this->_dir);
 }
コード例 #5
0
 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');
 }
コード例 #6
0
ファイル: WorklogTest.php プロジェクト: rockett/parables-demo
 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);
     }
 }
コード例 #7
0
 public function setUp()
 {
     parent::setUp();
     if (isset($GLOBALS['DOCTRINE_DSN']) && strlen($GLOBALS['DOCTRINE_DSN'])) {
         Doctrine_Manager::connection($GLOBALS['DOCTRINE_DSN']);
     } else {
         Doctrine_Manager::connection('sqlite::memory:');
     }
     Doctrine::loadModels(dirname(__FILE__) . '/_files/models');
     try {
         Doctrine::createTablesFromModels();
     } catch (Doctrine_Export_Exception $e) {
     }
 }
コード例 #8
0
 /**
  * Rebuilds a db as described by the doctrine models
  *
  */
 public function buildDBFromModels()
 {
     $icinga = $this->project->getUserProperty("PATH_Icinga");
     $modelPath = $icinga . "/app/modules/" . $this->project->getUserProperty("MODULE_Name") . "/lib/";
     $appKitPath = $this->project->getUserProperty("PATH_AppKit");
     Doctrine::loadModels($icinga . "/" . $appKitPath . "database/models/generated/");
     Doctrine::loadModel($icinga . "/" . $appKitPath . "database/models/");
     $tables = Doctrine::getLoadedModels();
     $tableList = array();
     foreach ($tables as $table) {
         $tableList[] = Doctrine::getTable($table)->getTableName();
     }
     Doctrine::createTablesFromModels(array($this->models . '/generated', $this->models));
     file_put_contents($modelPath . "/.models.cfg", implode(",", $tableList));
 }
コード例 #9
0
 public function registerPlugin(Bc_Application_Plugin_Descriptor $descriptor)
 {
     if ($this->isPluginRegistered($descriptor->getId())) {
         return;
     }
     if (is_dir($descriptor->getModelsPath())) {
         try {
             Doctrine::createTablesFromModels($descriptor->getModelsPath());
         } catch (Exception $e) {
             var_dump($e);
         }
     }
     $plugin = new Plugin();
     $plugin->name = $descriptor->getId();
     $plugin->description = $descriptor->getDescription();
     $plugin->title = $descriptor->getName();
     $plugin->active = true;
     $plugin->save();
 }
コード例 #10
0
ファイル: AllTests.php プロジェクト: rdohms/ugDirectory
 public function setUp()
 {
     try {
         //Load path configs
         $root_path = str_replace('test', '', dirname(__FILE__));
         $docCfg = Zend_Registry::get('config')->doctrine->toArray();
         foreach ($docCfg as &$cfg) {
             $cfg = str_replace("{ROOT_PATH}", $root_path, $cfg);
         }
         //Generate Database structure for tests
         $this->tearDown();
         Doctrine::createDatabases();
         Doctrine::createTablesFromModels($docCfg['models_path']);
         Doctrine::loadModel($docCfg['models_path']);
         Doctrine::loadData($docCfg['data_fixtures_path']);
         Util_Log::get()->UnitTests()->debug('Executed Env SetUp');
     } catch (Exception $e) {
         Util_Log::get()->UnitTests()->debug('Failed Setting up environment');
         Util_Log::get()->UnitTests()->err($e->getMessage());
     }
 }
コード例 #11
0
 protected function execute($arguments = array(), $options = array())
 {
     @$this->createCacheDirectory();
     $oldPluginList = sfFinder::type('dir')->in(sfConfig::get('sf_plugins_dir'));
     if (!$options['no-update-plugin']) {
         $this->installPlugins();
     }
     $newPluginList = sfFinder::type('dir')->name('op*Plugin')->maxdepth(1)->in(sfConfig::get('sf_plugins_dir'));
     $installedPlugins = array_map('basename', array_diff($newPluginList, $oldPluginList));
     if (!$options['no-build-model']) {
         $this->buildModel();
     }
     foreach ($installedPlugins as $v) {
         $modelDir = sfConfig::get('sf_lib_dir') . '/model/doctrine/' . $v;
         if (!is_dir($modelDir)) {
             continue;
         }
         Doctrine::createTablesFromModels($modelDir);
     }
     $targets = array_merge(array('OpenPNE'), $this->getEnabledOpenPNEPlugin());
     $databaseManager = new sfDatabaseManager($this->configuration);
     foreach ($targets as $target) {
         $params = array('version' => $options['to-version'], 'revision' => $options['to-revision']);
         $this->migrateFromScript($target, $databaseManager, $params);
     }
     if ($options['execute-generate']) {
         $this->migrateFromDiff();
     }
     $targets = array_merge($targets, $installedPlugins);
     foreach ($targets as $target) {
         $this->dataLoadForInitializePlugin($target);
     }
     if ($this->migrationException) {
         throw $this->migrationException;
     }
 }
コード例 #12
0
ファイル: functional.php プロジェクト: rbolliger/otokou
<?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'));
new sfDatabaseManager(sfContext::getInstance()->getConfiguration());
Doctrine::createTablesFromModels(dirname(__FILE__) . '/../../lib/model');
コード例 #13
0
ファイル: CreateTables.php プロジェクト: stelaireri/Hive
 public function execute()
 {
     Doctrine::createTablesFromModels($this->getArgument('models_path'));
     $this->notify('Created tables successfully');
 }
コード例 #14
0
ファイル: build-db.php プロジェクト: acohn/grinnellplans-php
<?php

require_once '../Plans.php';
Doctrine::createTablesFromModels();
コード例 #15
0
 public function testExportModelFromDirectory()
 {
     Doctrine::createTablesFromModels(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'export');
     $this->assertEqual($this->adapter->pop(), 'COMMIT');
     $this->assertEqual($this->adapter->pop(), 'ALTER TABLE cms__category_languages ADD CONSTRAINT cms__category_languages_category_id_cms__category_id FOREIGN KEY (category_id) REFERENCES cms__category(id) ON DELETE CASCADE');
     $this->assertEqual($this->adapter->pop(), 'CREATE TABLE cms__category_languages (id BIGINT AUTO_INCREMENT, name TEXT, category_id BIGINT, language_id BIGINT, INDEX index_category_idx (category_id), INDEX index_language_idx (language_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB');
     $this->assertEqual($this->adapter->pop(), 'CREATE TABLE cms__category (id BIGINT AUTO_INCREMENT, created DATETIME, parent BIGINT, position MEDIUMINT, active BIGINT, INDEX index_parent_idx (parent), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB');
     $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION');
 }
コード例 #16
0
// Environnement
define('ENV', 'test');
// Bootstrap
$Bootstrap = Bootstrap::getInstance();
$Bootstrap->setEnv(ENV);
$Bootstrap->loadConfigs(ROOT . '/configs/');
$Bootstrap->loadConfigs('../../configs/');
$Bootstrap->addModelPath(ROOT . '/models/bases/');
$Bootstrap->addModelPath(ROOT . '/models/');
$Bootstrap->setDoctrine();
// Drop et recréé la base de tests avec les fixtures
try {
    $Conn = Doctrine_Manager::connection();
    $Conn->dropDatabase();
    $Conn->createDatabase();
    Doctrine::createTablesFromModels(MODELS);
    Doctrine::LoadData(MODELS . 'fixtures/test/');
} catch (Exception $e) {
}
// define('ROOT',           realpath(dirname(__FILE__).'/../../')."/");
// define('CONTROLLERS',    ROOT.'controllers/default/');
// define('VIEWS',      ROOT.'views/default/');
// define('MODELS',         ROOT.'models/');
//
// require_once(ROOT.'_lib/vendors/simpletest/autorun.php');
// require_once ROOT.'_lib/core/_includes.php';
// require_once ROOT.'_lib/vendors/doctrine/Doctrine.php';
//
// // Environnement
// define('ENV', 'test');
//
コード例 #17
0
 public function dbAction()
 {
     $bootstrap = $this->getInvokeArg('bootstrap');
     $doctrine = $bootstrap->getResource('doctrine');
     Doctrine::createTablesFromModels($doctrine->getModelsPath());
 }
コード例 #18
0
ファイル: install.php プロジェクト: KasaiDot/Frac
function doPopulateDatabase()
{
    // Check for a config file, if it doesn't exist go through the steps to create it.
    if (!file_exists(dirname(__FILE__) . '/config.php')) {
        header("Location: " . $_SERVER["SCRIPT_NAME"] . "?do=step1");
        return;
    }
    require_once dirname(__FILE__) . "/config.php";
    require_once dirname(__FILE__) . "/fwork/lib/Doctrine/Doctrine.php";
    spl_autoload_register(array("Doctrine", "autoload"));
    Doctrine_Manager::connection($config["database"]["dsn"]);
    Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_TBLNAME_FORMAT, $config["database"]["prefix"] . "%s");
    Doctrine::createTablesFromModels(dirname(__FILE__) . "/models");
    $time = date("Y-m-d H:i:s");
    // roles
    $role_admin = new Role();
    $role_admin->name = "Admin";
    $role_admin->auth = 0xffffffff;
    $role_admin->created = $time;
    $role_admin->save();
    $role_staff = new Role();
    $role_staff->name = "Staff";
    $role_staff->auth = 0x7c700;
    $role_staff->created = $time;
    $role_staff->save();
    $role_guest = new Role();
    $role_guest->name = "Guest";
    $role_guest->auth = 0x0;
    $role_guest->created = $time;
    $role_guest->save();
    // staff
    $staff = new Staff();
    $staff->nickname = "admin";
    $staff->setPassword("admin");
    $staff->Role = $role_admin;
    $staff->admin = true;
    $staff->comment = "Administrator";
    $staff->created = $time;
    $staff->save();
    // task types
    $tasktypes = array('Raw Cap', 'Translate', 'Time', 'Translation Check', 'Typeset', 'Edit', 'Encode', 'Quality Check', 'Karaoke', 'Miscellaneous', 'Translate Signs', 'Release');
    foreach ($tasktypes as $key => $name) {
        $tasktype = new TaskType();
        $tasktype->name = $name;
        $tasktype->created = $time;
        $tasktype->save();
        $tasktypes[$key] = $tasktype;
    }
    // template
    $template = new Template();
    $template->name = "Default";
    $template->model = $tasktypes[0]->id . ":0->" . $tasktypes[1]->id . ":0; " . $tasktypes[0]->id . ":0->" . $tasktypes[10]->id . ":0; " . $tasktypes[10]->id . ":0->" . $tasktypes[4]->id . ":0; " . $tasktypes[4]->id . ":0->" . $tasktypes[3]->id . ":0; " . $tasktypes[1]->id . ":0->" . $tasktypes[2]->id . ":0; " . $tasktypes[1]->id . ":0->" . $tasktypes[3]->id . ":0; " . $tasktypes[3]->id . ":0->" . $tasktypes[5]->id . ":0; " . $tasktypes[5]->id . ":0->" . $tasktypes[6]->id . ":0; " . $tasktypes[6]->id . ":0->" . $tasktypes[7]->id . ":0; " . $tasktypes[7]->id . ":0->" . $tasktypes[11]->id . ":0; " . $tasktypes[2]->id . ":0->" . $tasktypes[5]->id . ":0; ";
    $template->created = $time;
    $template->save();
    // settings
    $settings = array('site.gzip' => true, 'site.gentime' => true);
    foreach ($settings as $name => $value) {
        $setting = new Setting();
        $setting->name = $name;
        $setting->value = $value;
        $setting->save();
        unset($setting);
    }
    echo <<<EOS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
\t<title>Frac :: Install</title>
\t<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
\t<h2>Frac Installer</h2>
\t<p>Table data populated successfully. You may now proceed to your <a href="./">Frac installation</a>. The username and password are "admin".</p>
</body>
</html>
EOS;
}
コード例 #19
0
ファイル: generateModels.php プロジェクト: p1r0/MuffinPHP
<?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);
コード例 #20
0
 protected function execute($arguments = array(), $options = array())
 {
     new sfDatabaseManager($this->configuration);
     // opening connection
     @$this->createCacheDirectory();
     $oldPluginList = sfFinder::type('dir')->in(sfConfig::get('sf_plugins_dir'));
     if (!$options['no-update-plugin']) {
         $this->installPlugins($options['target']);
     }
     $newPluginList = sfFinder::type('dir')->name('op*Plugin')->maxdepth(1)->in(sfConfig::get('sf_plugins_dir'));
     foreach ($oldPluginList as $k => $v) {
         $pluginName = basename($v);
         if ((bool) Doctrine::getTable('SnsConfig')->get($pluginName . '_needs_data_load', false)) {
             // It needs initializing
             unset($oldPluginList[$k]);
         }
     }
     $installedPlugins = array_map('basename', array_diff($newPluginList, $oldPluginList));
     if (!$options['no-build-model']) {
         $this->buildModel($options);
     }
     foreach ($installedPlugins as $v) {
         $modelDir = sfConfig::get('sf_lib_dir') . '/model/doctrine/' . $v;
         if (!is_dir($modelDir)) {
             continue;
         }
         Doctrine::createTablesFromModels($modelDir);
     }
     if ($options['target']) {
         $targets = array($options['target']);
     } else {
         $targets = array_merge(array('OpenPNE'), $this->getEnabledOpenPNEPlugin());
     }
     $databaseManager = new sfDatabaseManager($this->configuration);
     foreach ($targets as $target) {
         if (in_array($target, $installedPlugins)) {
             continue;
         }
         try {
             $this->migrateFromScript($target, $databaseManager);
         } catch (Doctrine_Migration_Exception $e) {
             if ('OpenPNE' === $target) {
                 throw $e;
             }
             $errorText = '';
             $errors = array();
             preg_match_all('/Error #[0-9]+ \\- .*$/m', $e->getMessage(), $errors, PREG_SET_ORDER);
             foreach ($errors as $error) {
                 $errorText .= $error[0] . "\n";
             }
             $e = new Exception(sprintf("migrating of %s encountered the following errors:\n %s", $target, $errorText));
             $this->commandApplication->renderException($e);
         }
     }
     $targets = array_merge($targets, $installedPlugins);
     foreach ($targets as $target) {
         $this->dataLoadForInitializePlugin($target);
     }
     if ($this->migrationException) {
         throw $this->migrationException;
     }
     $task = new sfPluginPublishAssetsTask($this->dispatcher, $this->formatter);
     $task->run(array(), array());
 }
コード例 #21
0
/**
 * This file is part of the ckWebServicePlugin
 *
 * @package   ckWebServicePlugin
 * @author    Christian Kerl <*****@*****.**>
 * @copyright Copyright (c) 2010, Christian Kerl
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 * @version   SVN: $Id: typeMappingDoctrineTest.php 28148 2010-02-20 14:02:31Z chrisk $
 */
$project = 'projectWithDoctrine';
$app = 'main';
$env = 'soap';
$debug = true;
include dirname(__FILE__) . '/../bootstrap/functional.php';
Doctrine::createTablesFromModels(sfConfig::get('sf_lib_dir') . '/model/');
Doctrine::loadData(sfConfig::get('sf_data_dir') . '/fixtures/');
class myArticle
{
    public $id, $title, $content, $Comments, $Authors;
}
class myComment
{
    public $id, $author, $content, $Article;
}
class myAuthor
{
    public $id, $name, $Articles;
}
function checkFixtureModel(ckTestSoapClient $c, $withAuthor)
{
コード例 #22
0
 function create_tables()
 {
     Doctrine::createTablesFromModels();
     echo "Tables created<br />";
 }
コード例 #23
0
 public function step2Action()
 {
     $this->reloadConfig();
     configureTheme(APPLICATION_THEME, 'install');
     $session = new Zend_Session_Namespace('Install');
     // Set up Doctrine DB
     require_once APPLICATION_DIRECTORY . '/Joobsbox/Db/Doctrine.php';
     $loader = Zend_Loader_Autoloader::getInstance();
     $loader->pushAutoloader(array('Doctrine', 'autoload'));
     $doctrineConfig = new Zend_Config_Xml(APPLICATION_DIRECTORY . "/config/db.xml", "doctrine");
     $manager = Doctrine_Manager::getInstance();
     $manager->setAttribute(Doctrine::ATTR_TBLNAME_FORMAT, $this->config->db->prefix . '%s');
     $manager->setCollate('utf8_unicode_ci');
     $manager->setCharset('utf8');
     $manager->openConnection($doctrineConfig->connection_string);
     Doctrine::createTablesFromModels($doctrineConfig->models_path);
     $db = Zend_Registry::get("db");
     $db->delete($this->config->db->prefix . "categories", array("Name='Uncategorized'"));
     $db->insert($this->config->db->prefix . "categories", array('ID' => 0, 'Name' => 'Uncategorized', 'Link' => 'Uncategorized', 'OrderIndex' => 100, 'Parent' => 0));
     // Make the form
     $this->adminForm = new Zend_Form();
     $this->adminForm->setAction($this->view->baseUrl . "/install/step2")->setMethod('post')->setLegend('Administrator credentials');
     $notEmpty = new Zend_Validate_NotEmpty();
     $realname = $this->adminForm->createElement('text', 'realname')->setLabel('Your name:')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->setAttrib('class', 'validate[required]')->addValidator($notEmpty->setMessage($this->view->translate("Real name is mandatory")))->setRequired(true);
     $notEmpty = clone $notEmpty;
     $username = $this->adminForm->createElement('text', 'username')->setLabel('Username:'******'StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->setAttrib('class', 'validate[required]')->addValidator($notEmpty->setMessage($this->view->translate("Username is mandatory")))->setRequired(true);
     $notEmpty = clone $notEmpty;
     $password = $this->adminForm->createElement('text', 'password')->setLabel('Password:'******'StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->setAttrib('class', 'validate[required]')->addValidator($notEmpty->setMessage($this->view->translate("Password is mandatory")))->setRequired(true);
     $notEmpty = clone $notEmpty;
     $emailValidator = new Zend_Validate_EmailAddress();
     $email = $this->adminForm->createElement('text', 'email')->setLabel('Email:')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('HtmlEntities')->setAttrib('class', 'validate[email,required]')->addValidator($notEmpty->setMessage($this->view->translate("Email is mandatory")))->addValidator($emailValidator->setMessage($this->view->translate("Email is invalid")))->setRequired(true);
     $submit = $this->adminForm->createElement('submit', 'Save')->setLabel('Save');
     $this->adminForm->addElement($realname)->addElement($username)->addElement($password)->addElement($email)->addElement($submit);
     $dg = $this->adminForm->addDisplayGroup(array('realname', 'username', 'password', 'email', 'Save'), 'user');
     if ($this->getRequest()->isPost()) {
         $this->validateAdminUser();
         return;
     }
     $this->view->form = $this->adminForm->render();
 }
コード例 #24
0
//Le digo a doctrine que realice todas las validaciones de integridad: valores nulos, constrains, etc.
$manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL);
//Permito los override en las clases
$manager->setAttribute(Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
if ($GLOBALS["BDLazyMode"]) {
    $manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
} else {
    $manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_AGGRESSIVE);
}
//Cargo todo el modelo
if (file_exists('../../model/generated')) {
    Doctrine::loadModels('../../model/generated');
} else {
    if ($GLOBALS["debugMode"]) {
        echo "No se ha encontrador el directorio 'model/generated'";
    }
}
if (file_exists('../../model')) {
    Doctrine::loadModels('../../model');
} else {
    if ($GLOBALS["debugMode"]) {
        echo "No se ha encontrador el directorio 'model'";
    }
}
//Debo hace un aggressive loadin de manera obligarotia, sino no se cargan todas las clases
$manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_AGGRESSIVE);
try {
    Doctrine::createTablesFromModels('../../model');
} catch (Exception $e) {
    die($e->getMessage());
}
コード例 #25
0
 public function setUp()
 {
     parent::setUp();
     Doctrine_Manager::connection('sqlite::memory:');
     Doctrine::createTablesFromModels();
 }
コード例 #26
0
 public function indexAction()
 {
     Doctrine::createTablesFromModels();
     exit;
 }