本文整理汇总了PHP中Doctrine\DBAL\Schema\Schema::visit方法的典型用法代码示例。如果您正苦于以下问题:PHP Schema::visit方法的具体用法?PHP Schema::visit怎么用?PHP Schema::visit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\Schema
的用法示例。
在下文中一共展示了Schema::visit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCleanupForeignKeysDifferentOrder
/**
* @group DBAL-204
*/
public function testCleanupForeignKeysDifferentOrder()
{
$config = new SchemaConfig();
$config->setName("test");
$schema = new Schema(array(), array(), $config);
$testTable = $schema->createTable("test.test");
$testTable->addColumn('id', 'integer');
$fooTable = $schema->createTable("foo.bar");
$fooTable->addColumn('id', 'integer');
$testTable->addForeignKeyConstraint("foo.bar", array("id"), array("id"));
$schema->visit(new RemoveNamespacedAssets());
$sql = $schema->toSql(new MySqlPlatform());
$this->assertEquals(1, count($sql), "Just one CREATE TABLE statement, no foreign key and table to foo.bar");
}
示例2: testMultiTenantNonPrimaryKey
public function testMultiTenantNonPrimaryKey()
{
$platform = new SQLAzurePlatform();
$visitor = new MultiTenantVisitor();
$schema = new Schema();
$foo = $schema->createTable('foo');
$foo->addColumn('id', 'string');
$foo->addColumn('created', 'datetime');
$foo->setPrimaryKey(array('id'));
$foo->addIndex(array('created'), 'idx');
$foo->getPrimaryKey()->addFlag('nonclustered');
$foo->getIndex('idx')->addFlag('clustered');
$schema->visit($visitor);
$this->assertEquals(array('id'), $foo->getPrimaryKey()->getColumns());
$this->assertTrue($foo->hasColumn('tenant_id'));
$this->assertEquals(array('created', 'tenant_id'), $foo->getIndex('idx')->getColumns());
}
示例3: dumpPhpSchema
/**
* @param Schema $schema
* @param OutputInterface $output
*/
protected function dumpPhpSchema(Schema $schema, OutputInterface $output)
{
$visitor = $this->getContainer()->get('oro_migration.tools.schema_dumper');
$schema->visit($visitor);
$output->writeln($visitor->dump($this->allowedTables, $this->namespace, $this->className, $this->version, $this->extendedFieldOptions));
}
示例4: testFixSchema_AddExplicitIndexForForeignKey
public function testFixSchema_AddExplicitIndexForForeignKey()
{
$schema = new Schema();
$tableA = $schema->createTable('foo');
$tableA->addColumn('id', 'integer');
$tableB = $schema->createTable('bar');
$tableB->addColumn('id', 'integer');
$tableB->addColumn('foo_id', 'integer');
$tableB->addForeignKeyConstraint($tableA, array('foo_id'), array('id'));
$this->assertEquals(0, count($tableB->getIndexes()));
$schema->visit(new \Doctrine\DBAL\Schema\Visitor\FixSchema(true));
$this->assertEquals(1, count($tableB->getIndexes()));
$indexes = $tableB->getIndexes();
$index = current($indexes);
$this->assertTrue($index->hasColumnAtPosition('foo_id', 0));
}