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


PHP Doctrine::loadModels方法代码示例

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


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

示例1: loadModels

 /**
  * Provides a array with all model names
  *
  * @return array
  */
 public function loadModels()
 {
     $models = Doctrine::loadModels($this->modelDir, Doctrine::MODEL_LOADING_CONSERVATIVE);
     $models = Doctrine::initializeModels($models);
     $this->models = Doctrine::filterInvalidModels($models);
     return $this->models;
 }
开发者ID:yuxw75,项目名称:Surrogate,代码行数:12,代码来源:doctrineGraphvizTaskTest.php

示例2: testTest

 public function testTest()
 {
     $models1 = Doctrine::loadModels(dirname(__FILE__) . '/1727/models1', Doctrine::MODEL_LOADING_CONSERVATIVE);
     $models2 = Doctrine::loadModels(dirname(__FILE__) . '/1727/models1', Doctrine::MODEL_LOADING_CONSERVATIVE);
     $this->assertEqual($models1, $models2);
     $models1 = Doctrine::loadModels(dirname(__FILE__) . '/1727/models1');
     $models2 = Doctrine::loadModels(dirname(__FILE__) . '/1727/models1');
     $this->assertEqual($models1, $models2);
     $models1 = Doctrine::loadModels(dirname(__FILE__) . '/1727/models1', Doctrine::MODEL_LOADING_CONSERVATIVE);
     $models2 = Doctrine::loadModels(dirname(__FILE__) . '/1727/models1', Doctrine::MODEL_LOADING_CONSERVATIVE);
     $this->assertEqual($models1, $models2);
     $models1 = Doctrine::loadModels(dirname(__FILE__) . '/1727/models2', Doctrine::MODEL_LOADING_CONSERVATIVE);
     $models2 = Doctrine::loadModels(dirname(__FILE__) . '/1727/models2', Doctrine::MODEL_LOADING_CONSERVATIVE);
     $this->assertEqual($models1, $models2);
     $models1 = Doctrine::loadModels(dirname(__FILE__) . '/1727/models2');
     $models2 = Doctrine::loadModels(dirname(__FILE__) . '/1727/models2');
     $this->assertEqual($models1, $models2);
     $models1 = Doctrine::loadModels(dirname(__FILE__) . '/1727/models2', Doctrine::MODEL_LOADING_CONSERVATIVE);
     $models2 = Doctrine::loadModels(dirname(__FILE__) . '/1727/models2', Doctrine::MODEL_LOADING_CONSERVATIVE);
     $this->assertEqual($models1, $models2);
     $models1 = Doctrine::loadModels(array(dirname(__FILE__) . '/1727/models1', dirname(__FILE__) . '/1727/models2'));
     $models2 = Doctrine::loadModels(array(dirname(__FILE__) . '/1727/models1', dirname(__FILE__) . '/1727/models2'));
     $this->assertEqual($models1, $models2);
     $models1 = Doctrine::loadModels(array(dirname(__FILE__) . '/1727/models1', dirname(__FILE__) . '/1727/models2'), Doctrine::MODEL_LOADING_CONSERVATIVE);
     $models2 = Doctrine::loadModels(array(dirname(__FILE__) . '/1727/models1', dirname(__FILE__) . '/1727/models2'), Doctrine::MODEL_LOADING_CONSERVATIVE);
     $this->assertEqual($models1, $models2);
 }
开发者ID:ninjapenguin,项目名称:kohana-Doctrine-module,代码行数:27,代码来源:1727TestCase.php

示例3: doctrine_load_models

function doctrine_load_models()
{
    if (file_exists(MODELS_DIRECTORY . DS . 'generated')) {
        Doctrine::loadModels(MODELS_DIRECTORY . DS . 'generated');
        Doctrine::loadModels(MODELS_DIRECTORY);
    }
}
开发者ID:silentworks,项目名称:codeigniter_doctrine,代码行数:7,代码来源:doctrine_pi.php

示例4: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $this->logSection('doctrine', 'created tables successfully');
     $databaseManager = new sfDatabaseManager($this->configuration);
     Doctrine::loadModels(sfConfig::get('sf_lib_dir') . '/model/doctrine', Doctrine::MODEL_LOADING_CONSERVATIVE);
     Doctrine::createTablesFromArray(Doctrine::getLoadedModels());
 }
开发者ID:yasirgit,项目名称:afids,代码行数:10,代码来源:sfDoctrineInsertSqlTask.class.php

示例5: init

 public function init()
 {
     $options = $this->getOptions();
     if (isset($options['configFile'])) {
         $config = new Zend_Config_Ini($options['configFile']);
         $config = $config->toArray();
     } else {
         $config = array();
     }
     require_once 'Doctrine.php';
     spl_autoload_register(array('Doctrine', 'autoload'));
     $manager = Doctrine_Manager::getInstance();
     $manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
     Zend_Registry::set('db_manager', $manager);
     if (isset($config['uri'])) {
         $connection = Doctrine_Manager::connection($config['uri']);
     }
     if (isset($config['modelsPath'])) {
         $this->_modelsPath = $config['modelsPath'];
         Doctrine::loadModels($this->_modelsPath);
     }
     if (isset($config['schemaPath'])) {
         $this->_schemaPath = $config['schemaPath'];
     }
     return $this;
 }
开发者ID:BGCX262,项目名称:zsoc-svn-to-git,代码行数:26,代码来源:Doctrine.php

示例6: setup

 public function setup()
 {
     $db = $this->databasemanager->getDatabase('doctrine');
     /* @var $db sfDoctrineDatabase */
     // Special Handling for postgre, since droping even when closing the connection, fails with
     // SQLSTATE[55006]: Object in use: 7 ERROR:  database "cs_doctrine_act_as_sortable_test" is being accessed by other users DETAIL:  There are 1 other session(s) using the database.
     if ($db->getDoctrineConnection() instanceof Doctrine_Connection_Pgsql) {
         try {
             $db->getDoctrineConnection()->createDatabase();
         } catch (Exception $e) {
         }
         $export = new Doctrine_Export_Pgsql($db->getDoctrineConnection());
         $import = new Doctrine_Import_Pgsql($db->getDoctrineConnection());
         $tablenames = array(SortableArticleTable::getInstance()->getTableName(), SortableArticleUniqueByTable::getInstance()->getTableName(), SortableArticleCategoryTable::getInstance()->getTableName());
         foreach ($tablenames as $tablename) {
             if ($import->tableExists($tablename)) {
                 $export->dropTable($tablename);
             }
         }
     } else {
         try {
             // ignore error if database does not yet exist (clean CI-env)
             $db->getDoctrineConnection()->dropDatabase();
         } catch (Exception $e) {
         }
         $db->getDoctrineConnection()->createDatabase();
     }
     // Using Doctrine instead of Doctrine_Core keeps it symfony 1.2 compatible, which uses
     Doctrine::loadModels(dirname(__FILE__) . '/../fixtures/project/lib/model/doctrine', Doctrine::MODEL_LOADING_CONSERVATIVE);
     Doctrine::createTablesFromArray(Doctrine::getLoadedModels());
     Doctrine::loadData(dirname(__FILE__) . '/../fixtures/project/data/fixtures/categories.yml');
 }
开发者ID:robo47,项目名称:csDoctrineActAsSortablePlugin-1,代码行数:32,代码来源:sfPluginTestBootstrap.class.php

示例7: testConservativeModelLoading

 public function testConservativeModelLoading()
 {
     $path = realpath('ModelLoadingTest/Conservative');
     $models = Doctrine::loadModels($path, Doctrine::MODEL_LOADING_CONSERVATIVE);
     $this->assertTrue(!class_exists('ConservativeModelLoadingUser', false));
     $this->assertTrue(!class_exists('ConservativeModelLoadingProfile', false));
     $this->assertTrue(!class_exists('ConservativeModelLoadingContact', false));
     $this->assertTrue(!class_exists('BaseConservativeModelLoadingUser', false));
 }
开发者ID:swk,项目名称:bluebox,代码行数:9,代码来源:BaseTestCase.php

示例8: execute

 public function execute()
 {
     Doctrine::loadModels($this->getArgument('models_path'));
     $dql = $this->getArgument('dql_query');
     $query = new Doctrine_Query();
     $this->notify('executing: "' . $dql . '"');
     $results = $query->query($dql);
     $this->printResults($results);
 }
开发者ID:kirvin,项目名称:the-nerdery,代码行数:9,代码来源:Dql.php

示例9: execute

 public function execute()
 {
     Doctrine::loadModels($this->getArgument('models_path'));
     $path = $this->getArgument('data_fixtures_path');
     if (is_array($path)) {
         $path = $path[0];
     }
     Doctrine::dumpData($path);
     $this->dispatcher->notify(sprintf('Dumped data successfully to: %s', $path));
 }
开发者ID:walterfrs,项目名称:mladek,代码行数:10,代码来源:DumpData.php

示例10: generateClassFromTable

 public function generateClassFromTable(Doctrine_Table $table)
 {
     $definition = array();
     $definition['columns'] = $table->getColumns();
     $definition['tableName'] = $table->getTableName();
     $definition['actAs'] = $table->getTemplates();
     $definition['generate_once'] = true;
     $generatedclass = $this->generateClass($definition);
     Doctrine::loadModels(sfConfig::get('sf_lib_dir') . '/model/doctrine/opCommunityTopicPlugin/base/');
     return $generatedclass;
 }
开发者ID:niryuu,项目名称:opCommunityTopicPlugin-100628,代码行数:11,代码来源:opCommunityTopicPluginImagesRecordGenerator.class.php

示例11: execute

 public function execute()
 {
     Doctrine::loadModels($this->getArgument('models_path'));
     $dql = $this->getArgument('dql_query');
     $query = new Doctrine_Query();
     $params = $this->getArgument('params');
     $params = $params ? explode(',', $params) : array();
     $this->notify('executing: "' . $dql . '" (' . implode(', ', $params) . ')');
     $results = $query->query($dql, $params, Doctrine::HYDRATE_ARRAY);
     $this->_printResults($results);
 }
开发者ID:stelaireri,项目名称:Hive,代码行数:11,代码来源:Dql.php

示例12: remove

 public static function remove(&$metadata)
 {
     $package = Doctrine::getTable('Package')->findOneByName($metadata['packageName']);
     if ($package) {
         Package_Message::log('debug', 'Remove package entry for ' . $metadata['packageName'] . '@' . $metadata['basedir'] . ' (' . $package['package_id'] . ')');
         $package->delete();
     }
     if (!empty($metadata['models'])) {
         $models = Doctrine::loadModels($metadata['directory'] . '/models', Doctrine::MODEL_LOADING_CONSERVATIVE);
         self::removeNumberType($models);
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:12,代码来源:Datastore.php

示例13: _initDoctrine

 protected function _initDoctrine()
 {
     //Load the autoloader
     Zend_Loader_Autoloader::getInstance()->registerNamespace('Doctrine')->pushAutoloader(array('Doctrine', 'autoload'));
     $manager = Doctrine_Manager::getInstance();
     foreach ($this->_options['doctrine']['attr'] as $key => $val) {
         $manager->setAttribute(eval("return Doctrine::{$key};"), $val);
     }
     $manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL);
     $conn = Doctrine_Manager::connection($this->_options['doctrine']['dsn'], 'doctrine');
     Doctrine::loadModels($this->_options["doctrine"]["module_directories"]);
 }
开发者ID:radalin,项目名称:zf-examples,代码行数:12,代码来源:Bootstrap.php

示例14: execute

 public function execute()
 {
     Doctrine::loadModels($this->getArgument('models_path'));
     $path = $this->getArgument('data_fixtures_path');
     if (is_array($path) && count($path) > 0) {
         $path = $path[0];
         Doctrine::dumpData($path);
         $this->notify(sprintf('Dumped data successfully to: %s', $path));
     } else {
         throw new Doctrine_Task_Exception('Unable to find data fixtures path.');
     }
 }
开发者ID:prismhdd,项目名称:victorioussecret,代码行数:12,代码来源:DumpData.php

示例15: buildSchema

 /**
  * buildSchema
  * 
  * Build schema array that can be dumped to file
  *
  * @param string $directory 
  * @return void
  */
 public function buildSchema($directory = null, $models = array())
 {
     if ($directory) {
         $loadedModels = Doctrine::loadModels($directory);
     } else {
         $loadedModels = Doctrine::getLoadedModels();
     }
     $array = array();
     $parent = new ReflectionClass('Doctrine_Record');
     $sql = array();
     $fks = array();
     // we iterate trhough the diff of previously declared classes
     // and currently declared classes
     foreach ($loadedModels as $className) {
         if (!empty($models) && !in_array($className, $models)) {
             continue;
         }
         $record = new $className();
         $recordTable = $record->getTable();
         $data = $recordTable->getExportableFormat();
         $table = array();
         foreach ($data['columns'] as $name => $column) {
             $data['columns'][$name]['type'] = $column['type'] . '(' . $column['length'] . ')';
             unset($data['columns'][$name]['length']);
         }
         $table['columns'] = $data['columns'];
         $relations = $recordTable->getRelations();
         foreach ($relations as $key => $relation) {
             $relationData = $relation->toArray();
             $relationKey = $relationData['alias'];
             if (isset($relationData['refTable']) && $relationData['refTable']) {
                 $table['relations'][$relationKey]['refClass'] = $relationData['refTable']->getComponentName();
             }
             if (isset($relationData['class']) && $relationData['class'] && $relation['class'] != $relationKey) {
                 $table['relations'][$relationKey]['class'] = $relationData['class'];
             }
             $table['relations'][$relationKey]['local'] = $relationData['local'];
             $table['relations'][$relationKey]['foreign'] = $relationData['foreign'];
             if ($relationData['type'] === Doctrine_Relation::ONE) {
                 $table['relations'][$relationKey]['type'] = 'one';
             } else {
                 if ($relationData['type'] === Doctrine_Relation::MANY) {
                     $table['relations'][$relationKey]['type'] = 'many';
                 } else {
                     $table['relations'][$relationKey]['type'] = 'one';
                 }
             }
         }
         $array[$className] = $table;
     }
     return $array;
 }
开发者ID:kirvin,项目名称:the-nerdery,代码行数:60,代码来源:Schema.php


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