當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PropelQuickBuilder::getDatabase方法代碼示例

本文整理匯總了PHP中PropelQuickBuilder::getDatabase方法的典型用法代碼示例。如果您正苦於以下問題:PHP PropelQuickBuilder::getDatabase方法的具體用法?PHP PropelQuickBuilder::getDatabase怎麽用?PHP PropelQuickBuilder::getDatabase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PropelQuickBuilder的用法示例。


在下文中一共展示了PropelQuickBuilder::getDatabase方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkDeletedFk

 private function checkDeletedFk()
 {
     $this->readDatabase();
     $diff = DatabaseComparator::computeDiff($this->database, $this->updatedBuilder->getDatabase());
     $sql = $this->database->getPlatform()->getModifyDatabaseDDL($diff);
     $expected = 'issue617_user';
     $this->assertNotContains($expected, $sql);
 }
開發者ID:bondarovich,項目名稱:Propel2,代碼行數:8,代碼來源:Issue617Test.php

示例2: checkDeletedFk

    private function checkDeletedFk()
    {
        $this->readDatabase();
        $diff = PropelDatabaseComparator::computeDiff($this->database, $this->updatedBuilder->getDatabase());
        $sql = $this->database->getPlatform()->getModifyDatabaseDDL($diff);
        $expected = '
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;

DROP TABLE IF EXISTS `book`;

# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
';
        $this->assertEquals($expected, $sql);
    }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:17,代碼來源:Issue617Test.php

示例3: testValidateReturnsTrueForValidSchema

    public function testValidateReturnsTrueForValidSchema()
    {
        $schema = <<<EOF
<database name="bookstore">
\t<table name="book">
\t\t<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
\t\t<column name="title" type="VARCHAR" size="100" primaryString="true" />
\t</table>
</database>
EOF;
        $builder = new PropelQuickBuilder();
        $builder->setSchema($schema);
        $database = $builder->getDatabase();
        $appData = new AppData();
        $appData->addDatabase($database);
        $validator = new PropelSchemaValidator($appData);
        $this->assertTrue($validator->validate());
    }
開發者ID:razielvalle,項目名稱:Propel,代碼行數:18,代碼來源:PropelSchemaValidatorTest.php

示例4: testTableWithPrefix

    public function testTableWithPrefix()
    {
        $schema = <<<EOF
<database name="default" tablePrefix="plop_">
    <table name="group">
        <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
        <column name="title" type="varchar" primaryString="true" size="255" />

        <behavior name="i18n">
            <parameter name="i18n_columns" value="title" />
            <parameter name="locale_column" value="locale" />
        </behavior>
    </table>
</database>
EOF;
        $builder = new PropelQuickBuilder();
        $builder->setSchema($schema);
        $this->assertTrue($builder->getDatabase()->hasTable('plop_group'));
        $this->assertFalse($builder->getDatabase()->hasTable('plop_plop_group_i18n'));
        $this->assertTrue($builder->getDatabase()->hasTable('plop_group_i18n'));
    }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:21,代碼來源:I18nBehaviorTest.php

示例5: testModiFyTableDoesNotMoveValidatorsOnNonI18nColumns

    public function testModiFyTableDoesNotMoveValidatorsOnNonI18nColumns()
    {
        $schema = <<<EOF
<database name="i18n_behavior_test_0">
\t<table name="i18n_behavior_test_0">
\t\t<column name="id" primaryKey="true" type="INTEGER" autoIncrement="true" />
\t\t<validator column="id">
\t\t\t<rule name="minLength" value="4" message="title must be at least 4 characters !" />
\t\t</validator>
\t\t<column name="title" type="VARCHAR" />
\t\t<behavior name="i18n">
\t\t\t<parameter name="i18n_columns" value="title" />
\t\t</behavior>
\t</table>
</database>
EOF;
        $builder = new PropelQuickBuilder();
        $builder->setSchema($schema);
        $table = $builder->getDatabase()->getTable('i18n_behavior_test_0');
        $this->assertEquals(1, count($table->getValidators()));
        $i18nTable = $builder->getDatabase()->getTable('i18n_behavior_test_0_i18n');
        $this->assertEquals(array(), $i18nTable->getValidators());
    }
開發者ID:ketheriel,項目名稱:ETVA,代碼行數:23,代碼來源:I18nBehaviorTest.php

示例6: testValidateReturnsFalseWhenCrossRefTableHasTwoFksToTheSameTable

    public function testValidateReturnsFalseWhenCrossRefTableHasTwoFksToTheSameTable()
    {
        $schema = <<<EOF
<database name="bookstore">
    <table name="book">
        <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
        <column name="title" type="VARCHAR" size="100" primaryString="true" />
    </table>
    <table name="book_book" isCrossRef="true">
        <column name="parent_id" type="INTEGER" primaryKey="true" required="true"/>
        <column name="child_id" type="INTEGER" primaryKey="true" required="true"/>
        <foreign-key foreignTable="book">
            <reference local="child_id" foreign="id"/>
        </foreign-key>
        <foreign-key foreignTable="book">
            <reference local="parent_id" foreign="id"/>
        </foreign-key>
    </table>
</database>
EOF;
        $builder = new PropelQuickBuilder();
        $builder->setSchema($schema);
        $database = $builder->getDatabase();
        $appData = new AppData();
        $appData->addDatabase($database);
        $validator = new PropelSchemaValidator($appData);
        $this->assertFalse($validator->validate());
        $this->assertContains('Table "book_book" implements an equal nest relationship for table "book". This feature is not supported', $validator->getErrors());
    }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:29,代碼來源:PropelSchemaValidatorTest.php

示例7: loadAndBuild

 protected function loadAndBuild()
 {
     $this->loadPropelQuickBuilder();
     if (!class_exists('Glorpen\\Propel\\PropelBundle\\Tests\\Fixtures\\Model\\Book', false)) {
         $builder = new \PropelQuickBuilder();
         $builder->getConfig()->setBuildProperty('behaviorEventClass', 'Behaviors.EventBehavior');
         $builder->getConfig()->setBuildProperty('behaviorExtendClass', 'Behaviors.ExtendBehavior');
         $builder->setSchema(static::$schema);
         $builder->setClassTargets(array('tablemap', 'peer', 'object', 'query', 'peerstub', 'querystub'));
         file_put_contents("/tmp/a.php", $builder->getClasses());
         $builder->build();
         $con = new EventPropelPDO('sqlite::memory:');
         $con->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $name = $builder->getDatabase()->getName();
         \Propel::setConnection($name, $con, \Propel::CONNECTION_READ);
         \Propel::setConnection($name, $con, \Propel::CONNECTION_WRITE);
         $builder->buildSQL($con);
     }
 }
開發者ID:karser,項目名稱:GlorpenPropelBundle,代碼行數:19,代碼來源:PropelTestCase.php


注:本文中的PropelQuickBuilder::getDatabase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。