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


PHP PropelQuickBuilder::setSchema方法代码示例

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


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

示例1: setUp

    public function setUp()
    {
        if (!class_exists('Post')) {
            $schema = <<<EOF
<database name="lockable_behavior" defaultIdMethod="native">
    <table name="post">
        <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />

        <column name="title" type="varchar" size="255" />
        <column name="description" type="longvarchar" />

        <behavior name="lockable">
            <parameter name="apply_to" value="title, description" />
            <parameter name="with_description" value="true" />
        </behavior>
    </table>
</database>
EOF;
            $builder = new PropelQuickBuilder();
            $config = $builder->getConfig();
            $config->setBuildProperty('behavior.visibility.class', '../src/LockableBehavior');
            $builder->setConfig($config);
            $builder->setSchema($schema);
            $builder->build();
        }
    }
开发者ID:donkeycode,项目名称:propel-lockable-behavior,代码行数:26,代码来源:LockableBehaviorTest.php

示例2: createBuilder

 protected function createBuilder()
 {
     $builder = new PropelQuickBuilder();
     $builder->setPlatform(new PgsqlPlatform());
     $builder->setSchema($this->getXMLSchema());
     return $builder;
 }
开发者ID:crzdeveloper,项目名称:propel-versionable,代码行数:7,代码来源:Issue693Test.php

示例3: setUp

    public function setUp()
    {
        $tables = array('Post' => <<<EOF
<database name="event_dispatcher_behavior" defaultIdMethod="native">
    <table name="post">
        <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
        <column name="name" type="VARCHAR" required="true" />

        <behavior name="event_dispatcher" />
    </table>
</database>
EOF
, 'Thread' => <<<EOF
<database name="event_dispatcher_behavior2" defaultIdMethod="native">
    <table name="thread">
        <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
        <column name="text" type="VARCHAR" required="true" />
        <column name="allowed" type="boolean" required="true" defaultValue="false" />

        <behavior name="event_dispatcher" />
    </table>
</database>
EOF
);
        foreach ($tables as $className => $schema) {
            if (!class_exists($className)) {
                $builder = new PropelQuickBuilder();
                $config = $builder->getConfig();
                $config->setBuildProperty('behavior.event_dispatcher.class', '../src/EventDispatcherBehavior');
                $builder->setConfig($config);
                $builder->setSchema($schema);
                $builder->build();
            }
        }
    }
开发者ID:GoldenLine,项目名称:EventDispatcherBehavior,代码行数:35,代码来源:EventDispatcherBehaviorTest.php

示例4: setUp

    protected function setUp()
    {
        parent::setUp();
        $this->loadPropelQuickBuilder();
        $schema = <<<XML
<database name="default" package="vendor.bundles.Propel.PropelBundle.Tests.Fixtures.DataFixtures.Loader" namespace="Propel\\PropelBundle\\Tests\\Fixtures\\DataFixtures\\Loader" defaultIdMethod="native">
    <table name="book">
        <column name="id" type="integer" primaryKey="true" />
        <column name="name" type="varchar" size="255" />
        <column name="description" type="varchar" />
        <column name="author_id" type="integer" required="false" defaultValue="null" />
        <column name="complementary_infos" required="false" type="object" description="An object column" />

        <foreign-key foreignTable="book_author" onDelete="RESTRICT" onUpdate="CASCADE">
            <reference local="author_id" foreign="id" />
        </foreign-key>
    </table>

    <table name="book_author">
        <column name="id" type="integer" primaryKey="true" />
        <column name="name" type="varchar" size="255" />
    </table>
</database>
XML;
        $builder = new \PropelQuickBuilder();
        $builder->setSchema($schema);
        if (class_exists('Propel\\PropelBundle\\Tests\\Fixtures\\DataFixtures\\Loader\\Book')) {
            $builder->setClassTargets(array());
        }
        $this->con = $builder->build();
    }
开发者ID:ChazalFlorian,项目名称:enjoyPangolin,代码行数:31,代码来源:TestCase.php

示例5: getBuilder

 protected function getBuilder($schema)
 {
     $builder = new PropelQuickBuilder();
     $config = $builder->getConfig();
     $config->setBuildProperty('behavior.equal_nest.class', '../src/EqualNestBehavior');
     $builder->setConfig($config);
     $builder->setSchema($schema);
     return $builder;
 }
开发者ID:VanTanev,项目名称:EqualNestBehavior,代码行数:9,代码来源:TestCase.php

示例6: testYamlLoadManyToMany

    public function testYamlLoadManyToMany()
    {
        $schema = <<<XML
<database name="default" package="vendor.bundles.Propel.PropelBundle.Tests.Fixtures.DataFixtures.Loader" namespace="Propel\\PropelBundle\\Tests\\Fixtures\\DataFixtures\\Loader" defaultIdMethod="native">
    <table name="book" phpName="YamlManyToManyBook">
        <column name="id" type="integer" primaryKey="true" />
        <column name="name" type="varchar" size="255" />
    </table>

    <table name="author" phpName="YamlManyToManyAuthor">
        <column name="id" type="integer" primaryKey="true" />
        <column name="name" type="varchar" size="255" />
    </table>

    <table name="book_author" phpName="YamlManyToManyBookAuthor">
        <column name="book_id" type="integer" required="true" primaryKey="true" />
        <column name="author_id" type="integer" required="true" primaryKey="true" />

        <foreign-key foreignTable="book" phpName="Book" onDelete="CASCADE" onUpdate="CASCADE">
            <reference local="book_id" foreign="id" />
        </foreign-key>
        <foreign-key foreignTable="author" phpName="Author" onDelete="CASCADE" onUpdate="CASCADE">
            <reference local="author_id" foreign="id" />
        </foreign-key>
    </table>
</database>
XML;
        $fixtures = <<<YAML
Propel\\PropelBundle\\Tests\\Fixtures\\DataFixtures\\Loader\\YamlManyToManyAuthor:
    Author_1:
        name: 'A famous one'
Propel\\PropelBundle\\Tests\\Fixtures\\DataFixtures\\Loader\\YamlManyToManyBook:
    Book_1:
        name: 'An important one'
Propel\\PropelBundle\\Tests\\Fixtures\\DataFixtures\\Loader\\YamlManyToManyBookAuthor:
    BookAuthor_1:
        book_id: Book_1
        author_id: Author_1

YAML;
        $filename = $this->getTempFile($fixtures);
        $builder = new \PropelQuickBuilder();
        $builder->setSchema($schema);
        $con = $builder->build();
        $loader = new YamlDataLoader(__DIR__ . '/../../Fixtures/DataFixtures/Loader');
        $loader->load(array($filename), 'default');
        $books = \Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\YamlManyToManyBookPeer::doSelect(new \Criteria(), $con);
        $this->assertCount(1, $books);
        $this->assertInstanceOf('Propel\\PropelBundle\\Tests\\Fixtures\\DataFixtures\\Loader\\YamlManyToManyBook', $books[0]);
        $authors = \Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\YamlManyToManyAuthorPeer::doSelect(new \Criteria(), $con);
        $this->assertCount(1, $authors);
        $this->assertInstanceOf('Propel\\PropelBundle\\Tests\\Fixtures\\DataFixtures\\Loader\\YamlManyToManyAuthor', $authors[0]);
        $bookAuthors = \Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\YamlManyToManyBookAuthorPeer::doSelect(new \Criteria(), $con);
        $this->assertCount(1, $bookAuthors);
        $this->assertInstanceOf('Propel\\PropelBundle\\Tests\\Fixtures\\DataFixtures\\Loader\\YamlManyToManyBookAuthor', $bookAuthors[0]);
    }
开发者ID:angelk,项目名称:PropelBundle,代码行数:56,代码来源:YamlDataLoaderTest.php

示例7: setUp

    public function setUp()
    {
        $this->schema = <<<EOF
<database name="bookstore" defaultIdMethod="native">
    <table name="typehinted_object">
        <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
        <column name="name" type="VARCHAR" size="100" primaryString="true" />
        <column name="roles" type="array" />

        <behavior name="typehintable">
            <parameter name="roles" value="array" />
        </behavior>
    </table>

    <table name="typehinted_user">
        <column name="id" type="INTEGER" primaryKey="true" autoIncrement="true"/>
        <column name="name" type="VARCHAR" size="32"/>
        <column name="catched_exception" type="OBJECT" />
        <column name="foo" type="OBJECT" />

        <behavior name="typehintable">
            <parameter name="typehinted_group" value="BaseTypehintedGroup" />
            <parameter name="catched_exception" value="Exception" />
            <parameter name="foo" value="TypehintedUser" />

            <parameter name="nullable_columns" value="foo, catched_exception" />
        </behavior>
    </table>

    <table name="typehinted_group">
        <column name="id" type="INTEGER" primaryKey="true" autoIncrement="true"/>
        <column name="name" type="VARCHAR" size="32"/>
    </table>

    <table name="typehinted_user_group" isCrossRef="true">
        <column name="user_id" type="INTEGER" primaryKey="true"/>
        <column name="group_id" type="INTEGER" primaryKey="true"/>

        <foreign-key foreignTable="typehinted_user">
            <reference local="user_id" foreign="id"/>
        </foreign-key>
        <foreign-key foreignTable="typehinted_group">
            <reference local="group_id" foreign="id"/>
        </foreign-key>
    </table>
</database>
EOF;
        if (!class_exists('TypehintedObject')) {
            $builder = new PropelQuickBuilder();
            $config = $builder->getConfig();
            $config->setBuildProperty('behavior.typehintable.class', __DIR__ . '/../src/TypehintableBehavior');
            $builder->setConfig($config);
            $builder->setSchema($this->schema);
            $builder->build();
        }
    }
开发者ID:ChazalFlorian,项目名称:enjoyPangolin,代码行数:56,代码来源:TypehintableBehaviorTest.php

示例8: assertEmptyBuilderOutput

 protected function assertEmptyBuilderOutput($schema)
 {
     $builder = new PropelQuickBuilder();
     $builder->setSchema($schema);
     ob_start();
     $builder->buildClasses();
     $output = preg_replace('/[\\r\\n]/', '', ob_get_contents());
     ob_end_clean();
     $this->assertEquals('', $output);
 }
开发者ID:thehereward,项目名称:Propel,代码行数:10,代码来源:GeneratedObjectConstantNameTest.php

示例9: simpleBuild

 protected function simpleBuild($SchemaFile, $Namespace)
 {
     $XML = $this->LoadSchema($SchemaFile, $Namespace);
     $builder = new \PropelQuickBuilder();
     $config = $builder->getConfig();
     $config->setBuildProperty('behaviorCacheableClass', 'RickySu\\CacheableBehaviorBundle\\Behavior\\CacheableBehavior');
     $builder->setConfig($config);
     $builder->setSchema($XML);
     $builder->build();
 }
开发者ID:rickysu,项目名称:cacheable-behavior-bundle,代码行数:10,代码来源:Base.php

示例10: dropForeignKey

    /**
     * Drop the foreign key in the `_user` table and check whether it generates
     * the correct `DROP` SQL.
     */
    private function dropForeignKey()
    {
        /*
         * Create issue617 tables without foreign keys
         */
        $this->readDatabase();
        $updatedSchema = '
<database name="reverse-bookstore">
<table name="issue617_user">
  <vendor type="mysql">
    <parameter name="Engine" value="InnoDB"/>
    <parameter name="Charset" value="utf8"/>
  </vendor>
  <column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
  <column name="full_name" type="VARCHAR" size="50" required="true" />
</table>

<table name="issue617_group">
  <vendor type="mysql">
    <parameter name="Engine" value="InnoDB"/>
    <parameter name="Charset" value="utf8"/>
  </vendor>
  <column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
  <column name="name" type="VARCHAR" size="50" required="true" />
</table>
</database>
';
        $this->updatedBuilder = new PropelQuickBuilder();
        $this->updatedBuilder->setPlatform($this->database->getPlatform());
        $this->updatedBuilder->setSchema($updatedSchema);
        $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`;

DROP TABLE IF EXISTS `foo`;

ALTER TABLE `issue617_user` DROP FOREIGN KEY `issue617_user_FK_1`;

DROP INDEX `issue617_user_FI_1` ON `issue617_user`;

ALTER TABLE `issue617_user` DROP `group_id`;

# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
';
        $this->assertEquals($expected, $sql);
        $this->updateSchema($this->updatedBuilder->getDatabase());
    }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:57,代码来源:Issue617Test.php

示例11: setUp

 public function setUp()
 {
     parent::setUp();
     $this->loadPropelQuickBuilder();
     $schema = file_get_contents(__DIR__ . '/../Fixtures/translation_schema.xml');
     $builder = new \PropelQuickBuilder();
     $builder->setSchema($schema);
     if (class_exists('Propel\\PropelBundle\\Tests\\Fixtures\\Model\\map\\TranslationTableMap')) {
         $builder->setClassTargets(array());
     }
     $this->con = $builder->build();
 }
开发者ID:ChazalFlorian,项目名称:enjoyPangolin,代码行数:12,代码来源:ModelTranslationTest.php

示例12: setUp

 public function setUp()
 {
     parent::setUp();
     $schema = file_get_contents(__DIR__ . '/../Resources/config/propel/acl_schema.xml');
     $builder = new \PropelQuickBuilder();
     $builder->setSchema($schema);
     if (!class_exists('Propel\\Bundle\\PropelAclBundle\\Model\\Acl\\map\\AclClassTableMap')) {
         $builder->setClassTargets(array('tablemap', 'peer', 'object', 'query'));
     } else {
         $builder->setClassTargets(array());
     }
     $this->con = $builder->build();
 }
开发者ID:propelorm,项目名称:PropelAclBundle,代码行数:13,代码来源:TestCase.php

示例13: testIndex

    public function testIndex()
    {
        $updatedSchema = '
<database>
  <table name="notification">
    <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
    <column name="target_user_id" required="true" type="INTEGER" />
    <column name="notification_type_unique_name" required="true" size="255" type="VARCHAR" />
    <column name="group_id" type="INTEGER" />
    <column name="date" required="true" type="TIMESTAMP" />
    <column name="objects" type="LONGVARCHAR" />
    <column name="is_new" defaultValue="1" required="true" type="BOOLEAN" />
    <foreign-key foreignTable="notification_type" name="FK_NOTIFICATION_TYPENOTIFICATION0">
      <reference foreign="unique_name" local="notification_type_unique_name" />
    </foreign-key>
    <index name="FK_NOTIFICATION_TARGET_USER">
      <index-column name="target_user_id" />
    </index>
    <index name="FK_NOTIFICATION_TYPENOTIFICATION">
      <index-column name="notification_type_unique_name" />
    </index>
  </table>
  <table name="notification_type">
    <column name="module_unique_name" primaryKey="true" required="true" size="255" type="VARCHAR" />
    <column name="unique_name" primaryKey="true" required="true" size="255" type="VARCHAR" />
    <column name="is_correction" defaultValue="0" required="true" type="BOOLEAN" />
    <column name="disabled_engine" size="255" type="VARCHAR" />
    <foreign-key foreignTable="module" name="FK_TYPENOTIFICATION_MODULE0" onDelete="CASCADE" onUpdate="CASCADE">
      <reference foreign="unique_name" local="module_unique_name" />
    </foreign-key>
    <index name="FK_TYPENOTIFICATION_MODULE">
      <index-column name="module_unique_name" />
    </index>
  </table>
  <table name="module">
    <column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
    <column name="unique_name" required="true" size="255" type="VARCHAR" />
    <column name="label" primaryString="true" required="true" size="255" type="VARCHAR" />
    <column name="description" required="true" size="255" type="VARCHAR" />
  </table>
</database>
';
        $actual = "\n# This is a fix for InnoDB in MySQL >= 4.1.x\n# It \"suspends judgement\" for fkey relationships until are tables are set.\nSET FOREIGN_KEY_CHECKS = 0;\n\n-- ---------------------------------------------------------------------\n-- notification\n-- ---------------------------------------------------------------------\n\nDROP TABLE IF EXISTS `notification`;\n\nCREATE TABLE `notification`\n(\n    `id` INTEGER NOT NULL AUTO_INCREMENT,\n    `target_user_id` INTEGER NOT NULL,\n    `notification_type_unique_name` VARCHAR(255) NOT NULL,\n    `group_id` INTEGER,\n    `date` DATETIME NOT NULL,\n    `objects` TEXT,\n    `is_new` TINYINT(1) DEFAULT 1 NOT NULL,\n    PRIMARY KEY (`id`),\n    INDEX `FK_NOTIFICATION_TARGET_USER` (`target_user_id`),\n    INDEX `FK_NOTIFICATION_TYPENOTIFICATION` (`notification_type_unique_name`),\n    CONSTRAINT `FK_NOTIFICATION_TYPENOTIFICATION0`\n        FOREIGN KEY (`notification_type_unique_name`)\n        REFERENCES `notification_type` (`unique_name`)\n) ENGINE=InnoDb;\n\n-- ---------------------------------------------------------------------\n-- notification_type\n-- ---------------------------------------------------------------------\n\nDROP TABLE IF EXISTS `notification_type`;\n\nCREATE TABLE `notification_type`\n(\n    `module_unique_name` VARCHAR(255) NOT NULL,\n    `unique_name` VARCHAR(255) NOT NULL,\n    `is_correction` TINYINT(1) DEFAULT 0 NOT NULL,\n    `disabled_engine` VARCHAR(255),\n    PRIMARY KEY (`module_unique_name`,`unique_name`),\n    INDEX `FK_TYPENOTIFICATION_MODULE` (`module_unique_name`),\n    INDEX `I_referenced_FK_NOTIFICATION_TYPENOTIFICATION0_1` (`unique_name`),\n    CONSTRAINT `FK_TYPENOTIFICATION_MODULE0`\n        FOREIGN KEY (`module_unique_name`)\n        REFERENCES `module` (`unique_name`)\n        ON UPDATE CASCADE\n        ON DELETE CASCADE\n) ENGINE=InnoDb;\n\n-- ---------------------------------------------------------------------\n-- module\n-- ---------------------------------------------------------------------\n\nDROP TABLE IF EXISTS `module`;\n\nCREATE TABLE `module`\n(\n    `id` INTEGER NOT NULL AUTO_INCREMENT,\n    `unique_name` VARCHAR(255) NOT NULL,\n    `label` VARCHAR(255) NOT NULL,\n    `description` VARCHAR(255) NOT NULL,\n    PRIMARY KEY (`id`)\n) ENGINE=InnoDb;\n\n# This restores the fkey checks, after having unset them earlier\nSET FOREIGN_KEY_CHECKS = 1;\n";
        $platform = new MysqlPlatform();
        $platform->setDefaultTableEngine('InnoDb');
        $updatedBuilder = new PropelQuickBuilder();
        $updatedBuilder->setPlatform($platform);
        $updatedBuilder->setSchema($updatedSchema);
        $sql = $updatedBuilder->getSQL();
        $this->assertEquals($actual, $sql);
    }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:51,代码来源:Issue651Test.php

示例14: setUp

    protected function setUp()
    {
        //begin of setting runtime environments
        $fileSystem = vfsStream::setup();
        $this->className = 'ExampleInstantiator';
        $this->extends = '\\stdClass';
        $this->indention = '  ';
        $this->namespace = 'Test\\Net\\Bazzline\\Propel';
        $this->path = $fileSystem->url();
        $this->prefix = 'create';
        //end of setting runtime environments
        $buildIsNeeded = !class_exists('TableOne') || !class_exists('TableTwo');
        if ($buildIsNeeded) {
            $schema = <<<EOF
<database name="example_database" defaultIdMethod="native">
    <behavior name="add_to_entity_instantiator">
        <parameter name="entity_instantiator_class_name" value="{$this->className}" />
        <parameter name="entity_instantiator_extends" value="{$this->extends}" />
        <parameter name="entity_instantiator_indention" value="{$this->indention}" />
        <parameter name="entity_instantiator_namespace" value="{$this->namespace}" />
        <parameter name="entity_instantiator_path_to_output" value="{$this->path}" />
        <parameter name="entity_method_name_prefix" value="{$this->prefix}" />
        <parameter name="entity_add_to_entity_instantiator" value="true" />
    </behavior>

    <table name="table_one">
        <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
    </table>

    <table name="table_two">
        <column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />

        <behavior name="add_to_entity_instantiator">
            <parameter name="entity_add_to_entity_instantiator" value="false" />
        </behavior>
    </table>
</database>
EOF;
            $builder = new PropelQuickBuilder();
            $configuration = $builder->getConfig();
            $configuration->setBuildProperty('behavior.add_to_entity_instantiator.class', __DIR__ . '/../source/AddToEntityInstantiatorBehavior');
            $builder->setConfig($configuration);
            $builder->setSchema($schema);
            $builder->build();
            //we have to call generate manually since it is called only when php execution is finished
            Manager::getInstance()->generate();
        }
    }
开发者ID:bazzline,项目名称:php_propel_behavior_entity_instantiator,代码行数:48,代码来源:AddToEntityInstantiatorBehaviorTest.php

示例15: setUp

    public function setUp()
    {
        if (!class_exists('Foo\\MyClassWithInterface')) {
            $schema = <<<EOF
<database name="a-database" namespace="Foo">
\t<table name="my_class_with_interface" interface="MyInterface">
\t\t<column name="id" required="true" primaryKey="true" autoIncrement="true" type="INTEGER" />
\t\t<column name="name" type="VARCHAR" />
\t</table>
</database>
EOF;
            $builder = new PropelQuickBuilder();
            $builder->setSchema($schema);
            $builder->buildClasses();
        }
    }
开发者ID:shelsonjava,项目名称:datawrapper,代码行数:16,代码来源:GeneratedObjectWithInterfaceTest.php


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