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


PHP PropelQuickBuilder::setClassTargets方法代码示例

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


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

示例1: 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="author_id" type="integer" required="false" defaultValue="null" />

        <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('peer', 'object', 'query', 'peerstub', 'objectstub', 'querystub'));
        } else {
            $builder->setClassTargets(array());
        }
        $this->con = $builder->build();
    }
开发者ID:angelk,项目名称:PropelBundle,代码行数:31,代码来源:TestCase.php

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

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

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

示例5: setUp

    public function setUp()
    {
        $this->loadPropelQuickBuilder();
        $schema = <<<SCHEMA
<database name="users" defaultIdMethod="native" namespace="Propel\\PropelBundle\\Tests\\Fixtures\\Model">
    <table name="user">
        <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
        <column name="username" type="varchar" size="255" primaryString="true" />
        <column name="algorithm" type="varchar" size="50" />
        <column name="salt" type="varchar" size="255" />
        <column name="password" type="varchar" size="255" />
        <column name="expires_at" type="timestamp" />
        <column name="roles" type="array" />
    </table>
</database>
SCHEMA;
        $builder = new \PropelQuickBuilder();
        $builder->setSchema($schema);
        $builder->setClassTargets(array('tablemap', 'peer', 'object', 'query', 'peerstub', 'querystub'));
        $builder->build();
    }
开发者ID:angelk,项目名称:PropelBundle,代码行数:21,代码来源:PropelUserProviderTest.php

示例6: testHydrateOverwritePreviousValues

    public function testHydrateOverwritePreviousValues()
    {
        $schema = <<<EOF
<database name="generated_object_complex_type_test_with_constructor">
    <table name="complex_column_type_entity_with_constructor">
        <column name="id" primaryKey="true" type="INTEGER" autoIncrement="true" />
        <column name="tags" type="ARRAY" />
    </table>
</database>
EOF;
        $builder = new PropelQuickBuilder();
        $builder->setSchema($schema);
        $builder->setClassTargets(array('tablemap', 'peer', 'object', 'query', 'peerstub', 'querystub'));
        $builder->build();
        require_once dirname(__FILE__) . '/fixtures/ComplexColumnTypeEntityWithConstructor.php';
        Propel::disableInstancePooling();
        // need to be disabled to test the hydrate() method
        $obj = new ComplexColumnTypeEntityWithConstructor();
        $this->assertEquals(array('foo', 'bar'), $obj->getTags());
        $obj->setTags(array('baz'));
        $this->assertEquals(array('baz'), $obj->getTags());
        $obj->save();
        $obj = ComplexColumnTypeEntityWithConstructorQuery::create()->findOne();
        $this->assertEquals(array('baz'), $obj->getTags());
        Propel::enableInstancePooling();
    }
开发者ID:kcornejo,项目名称:estadistica,代码行数:26,代码来源:GeneratedObjectArrayColumnTypeTest.php

示例7: exit

<?php

/*
 * This file is part of the FOSUserBundle package.
 *
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
if (!($loader = @(include __DIR__ . '/../vendor/autoload.php'))) {
    echo <<<EOT
You need to install the project dependencies using Composer:
\$ wget http://getcomposer.org/composer.phar
OR
\$ curl -s https://getcomposer.org/installer | php
\$ php composer.phar install --dev
\$ phpunit
EOT;
    exit(1);
}
if (class_exists('Propel')) {
    set_include_path(__DIR__ . '/../vendor/phing/phing/classes' . PATH_SEPARATOR . get_include_path());
    $class = new \ReflectionClass('TypehintableBehavior');
    $builder = new \PropelQuickBuilder();
    $builder->getConfig()->setBuildProperty('behavior.typehintable.class', $class->getFileName());
    $builder->setSchema(file_get_contents(__DIR__ . '/../Resources/config/propel/schema.xml'));
    $builder->setClassTargets(array('tablemap', 'peer', 'object', 'query'));
    $builder->build();
}
开发者ID:acorbel,项目名称:FOSUserBundle,代码行数:30,代码来源:bootstrap.php

示例8: getMockPropelConnection

 /**
  * @return \PropelPDO
  */
 protected function getMockPropelConnection()
 {
     if (!class_exists('Lexik\\Bundle\\TranslationBundle\\Propel\\om\\BaseFile')) {
         // classes are built in-memory.
         $builder = new \PropelQuickBuilder();
         $builder->setSchema(file_get_contents(__DIR__ . '/../../Resources/config/propel/schema.xml'));
         $builder->setClassTargets(array('tablemap', 'peer', 'object', 'query'));
         $con = $builder->build();
     } else {
         // in memory-classes already exist, create connection and SQL manually
         $dsn = 'sqlite::memory:';
         $adapter = new \DBSQLite();
         $con = new \PropelPDO($dsn, null, null);
         $con->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $name = 'default';
         if (!\Propel::isInit()) {
             \Propel::setConfiguration(array('datasources' => array('default' => $name)));
         }
         \Propel::setDB($name, $adapter);
         \Propel::setConnection($name, $con, \Propel::CONNECTION_READ);
         \Propel::setConnection($name, $con, \Propel::CONNECTION_WRITE);
         // don't rebuild classes
         $builder = new \PropelQuickBuilder();
         $builder->setSchema(file_get_contents(__DIR__ . '/../../Resources/config/propel/schema.xml'));
         $builder->buildSQL($con);
     }
     return $con;
 }
开发者ID:cwd,项目名称:LexikTranslationBundle,代码行数:31,代码来源:BaseUnitTestCase.php

示例9: loadFixtures

    protected function loadFixtures()
    {
        $this->loadPropelQuickBuilder();
        $schema = <<<XML
<database name="default" package="vendor.bundles.Propel.PropelBundle.Tests.Request.DataFixtures.Loader"
    namespace="Propel\\PropelBundle\\Tests\\Request\\ParamConverter" defaultIdMethod="native">
    <table name="my_book">
        <column name="id" type="integer" primaryKey="true" />
        <column name="name" type="varchar" size="255" />
        <column name="my_author_id" type="integer" required="true" />

        <foreign-key foreignTable="my_author" onDelete="CASCADE" onUpdate="CASCADE">
            <reference local="my_author_id" foreign="id" />
        </foreign-key>
    </table>

    <table name="my_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\\Request\\ParamConverter\\MyAuthor')) {
            $builder->setClassTargets(array());
        }
        $this->con = $builder->build();
        $this->con->useDebug(true);
        MyBookQuery::create()->deleteAll($this->con);
        MyAuthorQuery::create()->deleteAll($this->con);
        $author = new MyAuthor();
        $author->setId(10);
        $author->setName('Will');
        $book = new MyBook();
        $book->setId(1);
        $book->setName('PropelBook');
        $book->setMyAuthor($author);
        $book2 = new MyBook();
        $book2->setId(2);
        $book2->setName('sf2lBook');
        $book2->setMyAuthor($author);
        $author->save($this->con);
    }
开发者ID:ChazalFlorian,项目名称:enjoyPangolin,代码行数:44,代码来源:PropelParamConverterTest.php


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