当前位置: 首页>>代码示例>>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;未经允许,请勿转载。