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


PHP Doctrine::loadData方法代码示例

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


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

示例1: 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

示例2: loadData

 public function loadData($configuration)
 {
     new sfDatabaseManager($configuration);
     self::initiateDB($configuration);
     Doctrine::loadData(sfConfig::get('sf_test_dir') . '/fixtures');
     return $this;
 }
开发者ID:naturalsciences,项目名称:Darwin,代码行数:7,代码来源:DarwinTestFunctional.class.php

示例3: testI18nExport

 public function testI18nExport()
 {
     try {
         $i = new I18nTestExport();
         $i->Translation['en']->title = 'english test';
         $i->Translation['fr']->title = 'french test';
         $i->test_object = new stdClass();
         $i->save();
         $data = new Doctrine_Data();
         $data->exportData('test.yml', 'yml', array('I18nTestExport', 'I18nTestExportTranslation'));
         $array = Doctrine_Parser::load('test.yml', 'yml');
         $this->assertTrue(!empty($array));
         $this->assertTrue(isset($array['I18nTestExport']['I18nTestExport_1']));
         $this->assertTrue(isset($array['I18nTestExportTranslation']['I18nTestExportTranslation_1_en']));
         $this->assertTrue(isset($array['I18nTestExportTranslation']['I18nTestExportTranslation_1_fr']));
         $i->Translation->delete();
         $i->delete();
         Doctrine::loadData('test.yml');
         $q = Doctrine_Query::create()->from('I18nTestExport e')->leftJoin('e.Translation t');
         $results = $q->execute();
         $this->assertEqual(get_class($results[0]->test_object), 'stdClass');
         $this->pass();
     } catch (Exception $e) {
         $this->fail($e->getMessage());
     }
     if (file_exists('test.yml')) {
         unlink('test.yml');
     }
 }
开发者ID:ninjapenguin,项目名称:kohana-Doctrine-module,代码行数:29,代码来源:ExportTestCase.php

示例4: loadData

 /**
  * DOCUMENT ME
  * @param mixed $path
  * @return mixed
  */
 public function loadData($path = null)
 {
     if (!$path) {
         $path = sfConfig::get('sf_test_dir') . '/fixtures';
     }
     Doctrine::loadData($path);
     return $this;
 }
开发者ID:hashir,项目名称:UoA,代码行数:13,代码来源:aTestFunctional.class.php

示例5: run

 public function run()
 {
     $path = $this->options['dir'] . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . $this->options['name'] . '.yml';
     if (!file_exists($path)) {
         throw new RuntimeException('The specified yml doesn\'t exist.');
     }
     Doctrine::loadData($path, true);
 }
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:8,代码来源:opUpgradeDataLoadStrategy.class.php

示例6: loadData

 public function loadData($file = null)
 {
     $fixture = sfConfig::get('sf_test_dir') . '/fixtures';
     if ($file !== null) {
         $fixture .= "/{$file}";
     }
     Doctrine::loadData($fixture);
 }
开发者ID:handlename,项目名称:myDoctrineTest,代码行数:8,代码来源:myDoctrineTest.class.php

示例7: setUp

 public function setUp()
 {
     parent::resetMongo();
     sfConfig::set('sf_environment', 'test');
     Doctrine::loadData(dirname(__FILE__) . '/fixtures');
     sfConfig::set('sf_environment', 'dev');
     $this->from = date('Y-m-d', strtotime("today"));
     $this->to = date('Y-m-d', strtotime("tomorrow"));
 }
开发者ID:42medien,项目名称:spreadly,代码行数:9,代码来源:ChartDataHelperTest.php

示例8: testUpdateOwnedIdentities

 public function testUpdateOwnedIdentities()
 {
     parent::resetMongo();
     Doctrine::loadData(dirname(__FILE__) . '/fixtures');
     $lUserHugo = UserTable::getByIdentifier('hugo');
     $lUserHugo->updateOwnedIdentities(array("1", "2", "34"));
     $lRelation = $lUserHugo->retrieveUserRelations();
     $this->assertTrue(in_array("34", $lRelation->getOwnedOi()));
 }
开发者ID:42medien,项目名称:spreadly,代码行数:9,代码来源:UserTest.php

示例9: load_fixtures

    function load_fixtures()
    {
        echo 'This will delete all existing data!<br />
		<form action="" method="POST">
		<input type="submit" name="action" value="Load Fixtures"><br /><br />';
        if ($this->input->post('action')) {
            Doctrine_Manager::connection()->execute('SET FOREIGN_KEY_CHECKS = 0');
            Doctrine::loadData(APPPATH . '/fixtures');
            echo "Done!";
        }
    }
开发者ID:voltxion,项目名称:Project-Urza,代码行数:11,代码来源:doctrine_tools.php

示例10: loadData

 public function loadData($file = null)
 {
     if ($this->connection == null) {
         $this->connection = Doctrine_Manager::connection();
         $this->connection->beginTransaction();
     }
     $fixture = sfConfig::get('sf_test_dir') . '/fixtures';
     if ($file !== null) {
         $fixture .= "/{$file}";
     }
     Doctrine::loadData($fixture);
 }
开发者ID:handlename,项目名称:MyDoctrineTester,代码行数:12,代码来源:sfDoctrineTest.class.php

示例11: 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

示例12: testTest

    public function testTest()
    {
        $yml = <<<END
Ticket_1351_Article:
  Ticket_1351_Article_1:
    Translation:
      en:
        title: Test title english
        body: Test body english
      fr:
        title: Test title french
        body: Test body french
END;
        file_put_contents('test.yml', $yml);
        Doctrine::loadData('test.yml', true);
        unlink('test.yml');
        $results = Doctrine_Query::create()->from('Ticket_1351_Article a, a.Translation t')->fetchArray();
        $this->assertEqual($results[0]['Translation']['en']['title'], 'Test title english');
    }
开发者ID:swk,项目名称:bluebox,代码行数:19,代码来源:1351TestCase.php

示例13: setUp

 public function setUp()
 {
     //parent::resetMongo();
     sfConfig::set('sf_environment', 'test');
     Doctrine::loadData(dirname(__FILE__) . '/fixtures');
     sfConfig::set('sf_environment', 'dev');
     $this->table = Doctrine::getTable('Deal');
     $this->deal1 = $this->table->findOneBy('name', 'Campaign No. 1');
     $this->deal2 = $this->table->findOneBy('name', 'Campaign No. 2');
     $this->deal3 = $this->table->findOneBy('name', 'Campaign No. 3');
     $this->deal4 = $this->table->findOneBy('name', 'Campaign No. 4');
     $this->deal5 = $this->table->findOneBy('name', 'Campaign No. 5');
     $this->deal6 = $this->table->findOneBy('name', 'Campaign No. 6');
     $this->deal7 = $this->table->findOneBy('name', 'Campaign No. 7');
     $this->dealCommission1 = $this->table->findOneBy('name', 'Campaign No. Commission 1');
     $this->dealCommission2 = $this->table->findOneBy('name', 'Campaign No. Commission 2');
     $this->dealCommission3 = $this->table->findOneBy('name', 'Campaign No. Commission 3');
     $this->hugo = UserTable::getInstance()->findOneByUsername('hugo');
     $this->affe = UserTable::getInstance()->findOneByUsername('affe');
 }
开发者ID:42medien,项目名称:spreadly,代码行数:20,代码来源:DealTest.php

示例14: action_load_fixtures

    function action_load_fixtures()
    {
        ?>
		This will delete all existing data!<br />
		<form action="" method="POST">
			<input type="submit" name="schema" value="Load Schema"><br /><br />
		<?php 
        ?>
		This will delete all existing data!<br />
		<form action="" method="POST">
			<input type="submit" name="data" value="Load Fixtures"><br /><br />
		<?php 
        if (!empty($_POST['schema'])) {
            Doctrine_Core::generateModelsFromYaml(APPPATH . DIRECTORY_SEPARATOR . 'doctrine/fixtures/schema', APPPATH . DIRECTORY_SEPARATOR . 'doctrine/models', array('generateBaseClasses' => false));
            echo "Done!";
        } elseif (!empty($_POST['data'])) {
            Doctrine_Manager::connection()->execute("\r\n\t\t\t\tSET FOREIGN_KEY_CHECKS = 0\r\n\t\t\t");
            Doctrine::loadData(APPPATH . DIRECTORY_SEPARATOR . 'doctrine/fixtures/data');
            echo "Done!";
        }
    }
开发者ID:abdul-baten,项目名称:hbcms,代码行数:21,代码来源:doctrine.php

示例15: 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


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