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


PHP Table::setNamespace方法代码示例

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


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

示例1: testTableNamespaceAndDbNamespace

 public function testTableNamespaceAndDbNamespace()
 {
     $d = new Database('fooDb');
     $d->setNamespace('Baz');
     $t = new Table('fooTable');
     $t->setNamespace('Foo\\Bar');
     $d->addTable($t);
     $builder = new TestableOMBuilder2($t);
     $this->assertEquals('Baz\\Foo\\Bar', $builder->getNamespace(), 'Builder namespace is composed from the database and table namespaces when both are set');
 }
开发者ID:rouffj,项目名称:Propel2,代码行数:10,代码来源:AbstractOMBuilderNamespaceTest.php

示例2: _before

 /**
  * @return void
  */
 protected function _before()
 {
     $config = new QuickGeneratorConfig();
     $table = new Table('Foo');
     $column = new Column('testColumn', PropelTypes::INTEGER);
     $table->addColumn($column);
     $table->setNamespace('Unit\\Spryker\\Zed\\Propel\\Business\\Builder\\QueryBuilder');
     $table->setDatabase(new Database('TestDB', new DefaultPlatform()));
     foreach ($this->getFilesToGenerate() as $fileName => $builderClass) {
         $builder = new $builderClass($table);
         $builder->setGeneratorConfig($config);
         $this->writePropelFile($builder, $fileName);
     }
 }
开发者ID:spryker,项目名称:Propel,代码行数:17,代码来源:QueryBuilderTest.php

示例3: computeTableNamespace

 /**
  * Computes the table namespace based on the current relative or
  * absolute table namespace and the database namespace.
  *
  * @param  Table  $table
  * @return string
  */
 private function computeTableNamespace(Table $table)
 {
     $namespace = $table->getNamespace();
     if ($this->isAbsoluteNamespace($namespace)) {
         $namespace = ltrim($namespace, '\\');
         $table->setNamespace($namespace);
         return $namespace;
     }
     if ($namespace = $this->getNamespace()) {
         if ($table->getNamespace()) {
             $namespace .= '\\' . $table->getNamespace();
         }
         $table->setNamespace($namespace);
     }
     return $namespace;
 }
开发者ID:a-melnichuk,项目名称:Movies-Demo,代码行数:23,代码来源:Database.php

示例4: testSetNamespace

 /**
  * @dataProvider provideNamespaces
  *
  */
 public function testSetNamespace($namespace, $expected)
 {
     $table = new Table();
     $table->setNamespace($namespace);
     $this->assertSame($expected, $table->getNamespace());
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:10,代码来源:TableTest.php

示例5: Table

$table3->setPackage('Acme.Blog');
$table3->addColumns([$column31, $column32]);
$table4 = new Table('blog_tag');
$table4->setDescription('The list of tags');
$table4->setNamespace('Blog');
$table4->setPackage('Acme.Blog');
$table4->addColumns([$column41, $column42]);
$table5 = new Table('blog_post_tag');
$table5->setNamespace('Blog');
$table5->setPackage('Acme.Blog');
$table5->setCrossRef();
$table5->addColumns([$column51, $column52]);
$table5->addForeignKeys([$fkPostTag, $fkTagPost]);
$table6 = new Table('cms_page');
$table6->setPhpName('Page');
$table6->setNamespace('Cms');
$table6->setBaseClass('Acme\\Model\\PublicationActiveRecord');
$table6->setPackage('Acme.Cms');
$table6->addColumns([$column61, $column62, $column63, $column64]);
$table6->addIndex($pageContentFulltextIdx);
$table6->addVendorInfo(new VendorInfo('mysql', ['Engine' => 'MyISAM']));
/* Database */
$database = new Database('acme_blog', new MysqlPlatform());
$database->setSchema('acme');
$database->setTablePrefix('acme_');
$database->setNamespace('Acme\\Model');
$database->setBaseClass('Acme\\Model\\ActiveRecord');
$database->setPackage('Acme');
$database->setHeavyIndexing();
$database->addVendorInfo(new VendorInfo('mysql', ['Engine' => 'InnoDB', 'Charset' => 'utf8']));
$database->addTables([$table1, $table2, $table3, $table4, $table5, $table6]);
开发者ID:disider,项目名称:Propel2,代码行数:31,代码来源:blog-database.php

示例6: testAppendXmlNamespaceWithAutoPackage

    public function testAppendXmlNamespaceWithAutoPackage()
    {
        $schema = <<<EOF
<?xml version="1.0"?>
<table name="test" namespace="\\testNs"/>
EOF;
        $doc = new DOMDocument('1.0');
        $doc->formatOutput = true;
        $config = new GeneratorConfig();
        $config->setBuildProperties(array('propel.namespace.autoPackage' => 'true'));
        $appData = new AppData();
        $appData->setGeneratorConfig($config);
        $db = new Database('testDb');
        $db->setAppData($appData);
        $table = new Table('test');
        $table->setDatabase($db);
        $table->setNamespace('\\testNs');
        $table->appendXml($doc);
        $xmlstr = trim($doc->saveXML());
        $this->assertSame($schema, $xmlstr);
        $schema = <<<EOF
<?xml version="1.0"?>
<table name="test" namespace="\\testNs" package="testPkg"/>
EOF;
        $doc = new DOMDocument('1.0');
        $doc->formatOutput = true;
        $table->setPackage('testPkg');
        $table->appendXml($doc);
        $xmlstr = trim($doc->saveXML());
        $this->assertSame($schema, $xmlstr);
    }
开发者ID:rouffj,项目名称:Propel2,代码行数:31,代码来源:TableTest.php

示例7: testAddTableSkipsDatabaseNamespaceWhenTableNamespaceIsAbsolute

 public function testAddTableSkipsDatabaseNamespaceWhenTableNamespaceIsAbsolute()
 {
     $db = new Database();
     $db->setNamespace('Foo');
     $t1 = new Table('t1');
     $t1->setNamespace('\\Bar');
     $db->addTable($t1);
     $this->assertEquals('Bar', $t1->getNamespace());
 }
开发者ID:norfil,项目名称:Propel2,代码行数:9,代码来源:DatabaseTest.php

示例8: testValidateReturnsTrueWhenTwoTablesHaveSamePhpNameInDifferentNamespaces

 public function testValidateReturnsTrueWhenTwoTablesHaveSamePhpNameInDifferentNamespaces()
 {
     $column1 = new Column('id');
     $column1->setPrimaryKey(true);
     $table1 = new Table('foo');
     $table1->addColumn($column1);
     $table1->setNamespace('Foo');
     $column2 = new Column('id');
     $column2->setPrimaryKey(true);
     $table2 = new Table('bar');
     $table2->addColumn($column2);
     $table2->setPhpName('Foo');
     $table2->setNamespace('Bar');
     $database = new Database();
     $database->addTable($table1);
     $database->addTable($table2);
     $schema = new Schema();
     $schema->addDatabase($database);
     $validator = new SchemaValidator($schema);
     $this->assertTrue($validator->validate());
 }
开发者ID:robin850,项目名称:Propel2,代码行数:21,代码来源:SchemaValidatorTest.php


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