本文整理汇总了PHP中Propel\Generator\Model\Table::setPhpName方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::setPhpName方法的具体用法?PHP Table::setPhpName怎么用?PHP Table::setPhpName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Generator\Model\Table
的用法示例。
在下文中一共展示了Table::setPhpName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testValidateReturnsFalseWhenTwoTablesHaveSamePhpName
public function testValidateReturnsFalseWhenTwoTablesHaveSamePhpName()
{
$table1 = new Table('foo');
$table2 = new Table('bar');
$table2->setPhpName('Foo');
$database = new Database();
$database->addTable($table1);
$database->addTable($table2);
$appData = new AppData();
$appData->addDatabase($database);
$validator = new SchemaValidator($appData);
$this->assertFalse($validator->validate());
$this->assertContains('Table "bar" declares a phpName already used in another table', $validator->getErrors());
}
示例2: testSetCustomPhpName
public function testSetCustomPhpName()
{
$table = new Table('created_at');
$table->setPhpName('CreatedAt');
$this->assertSame('CreatedAt', $table->getPhpName());
$this->assertSame('createdAt', $table->getCamelCaseName());
}
示例3: Table
$table3->setNamespace('Blog');
$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']));
示例4: 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());
}