当前位置: 首页>>代码示例>>PHP>>正文


PHP Doctrine::createTablesFromModels方法代码示例

本文整理汇总了PHP中Doctrine::createTablesFromModels方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine::createTablesFromModels方法的具体用法?PHP Doctrine::createTablesFromModels怎么用?PHP Doctrine::createTablesFromModels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine的用法示例。


在下文中一共展示了Doctrine::createTablesFromModels方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doctrine_create_database

/**
 * Create Database Tables from Models
 */
function doctrine_create_database()
{
    if (count(scandir(MODELS_DIRECTORY)) == 2) {
        doctrine_create_models();
    }
    Doctrine::createTablesFromModels(MODELS_DIRECTORY);
}
开发者ID:silentworks,项目名称:codeigniter_doctrine,代码行数:10,代码来源:doctrine_pi.php

示例2: createTables

 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();
     }
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:8,代码来源:dbInitializeTask.php

示例3: create_tables

    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!";
        }
    }
开发者ID:slugmandrew,项目名称:ci_doctrine,代码行数:10,代码来源:doctrine_tools.php

示例4: main

 /**
  * 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);
 }
开发者ID:jkinner,项目名称:ringside,代码行数:14,代码来源:DoctrineExportTask.php

示例5: doctrineAction

 public function doctrineAction()
 {
     $options = array('phpDocPackage' => 'Kromatick', 'phpDocSubpackage' => 'Intermodels', 'phpDocName' => 'Neozeratul', 'phpDocEmail' => 'neozeratul@gmail.com');
     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');
 }
开发者ID:Neozeratul,项目名称:Intermodels,代码行数:11,代码来源:IndexController.php

示例6: setUp

 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);
     }
 }
开发者ID:rockett,项目名称:parables-demo,代码行数:13,代码来源:WorklogTest.php

示例7: setUp

 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) {
     }
 }
开发者ID:lciolecki,项目名称:zf-doctrine,代码行数:14,代码来源:DoctrineTest.php

示例8: buildDBFromModels

 /**
  * 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));
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:19,代码来源:doctrineDBBuilderTask.php

示例9: registerPlugin

 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();
 }
开发者ID:BGCX262,项目名称:zsoc-svn-to-git,代码行数:19,代码来源:ManagerDao.php

示例10: setUp

 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());
     }
 }
开发者ID:rdohms,项目名称:ugDirectory,代码行数:21,代码来源:AllTests.php

示例11: execute

 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;
     }
 }
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:36,代码来源:openpneMigrateTask.class.php

示例12: debug_backtrace

<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * 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');
开发者ID:rbolliger,项目名称:otokou,代码行数:23,代码来源:functional.php

示例13: execute

 public function execute()
 {
     Doctrine::createTablesFromModels($this->getArgument('models_path'));
     $this->notify('Created tables successfully');
 }
开发者ID:stelaireri,项目名称:Hive,代码行数:5,代码来源:CreateTables.php

示例14:

<?php

require_once '../Plans.php';
Doctrine::createTablesFromModels();
开发者ID:acohn,项目名称:grinnellplans-php,代码行数:4,代码来源:build-db.php

示例15: testExportModelFromDirectory

 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');
 }
开发者ID:ninjapenguin,项目名称:kohana-Doctrine-module,代码行数:9,代码来源:RecordTestCase.php


注:本文中的Doctrine::createTablesFromModels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。