本文整理汇总了PHP中Doctrine\DBAL\Schema\Schema::hasTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Schema::hasTable方法的具体用法?PHP Schema::hasTable怎么用?PHP Schema::hasTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\Schema
的用法示例。
在下文中一共展示了Schema::hasTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateConfigs
/**
* Modify entity config to exclude currency and currency_precision fields
*
* @param Schema $schema
* @param QueryBag $queries
*/
public static function updateConfigs(Schema $schema, QueryBag $queries)
{
$table = $schema->getTable('oro_organization');
$table->dropColumn('currency');
$table->dropColumn('currency_precision');
if ($schema->hasTable('oro_entity_config_index_value') && $schema->hasTable('oro_entity_config_field')) {
$queries->addPostQuery('DELETE FROM oro_entity_config_index_value
WHERE entity_id IS NULL AND field_id IN(
SELECT oecf.id FROM oro_entity_config_field AS oecf
WHERE
(oecf.field_name = \'precision\' OR oecf.field_name = \'currency\')
AND
oecf.entity_id = (
SELECT oec.id
FROM oro_entity_config AS oec
WHERE oec.class_name = \'Oro\\\\Bundle\\\\OrganizationBundle\\\\Entity\\\\Organization\'
)
);
DELETE FROM oro_entity_config_field
WHERE
field_name IN (\'precision\', \'currency\')
AND
entity_id IN (
SELECT id
FROM oro_entity_config
WHERE class_name = \'Oro\\\\Bundle\\\\OrganizationBundle\\\\Entity\\\\Organization\'
)');
}
}
示例2: testCreateTable
public function testCreateTable()
{
$schema = new Schema();
$this->assertFalse($schema->hasTable("foo"));
$table = $schema->createTable("foo");
$this->assertType('Doctrine\\DBAL\\Schema\\Table', $table);
$this->assertEquals("foo", $table->getName());
$this->assertTrue($schema->hasTable("foo"));
}
示例3: updateConfigs
/**
* Modify entity config to exclude currency and currency_precision fields
*
* @param Schema $schema
* @param QueryBag $queries
*/
public static function updateConfigs(Schema $schema, QueryBag $queries)
{
$table = $schema->getTable('oro_organization');
$table->dropColumn('currency');
$table->dropColumn('currency_precision');
if ($schema->hasTable('oro_entity_config_index_value') && $schema->hasTable('oro_entity_config_field')) {
$queries->addPostQuery(new ParametrizedSqlMigrationQuery('DELETE FROM oro_entity_config_index_value ' . 'WHERE entity_id IS NULL AND field_id IN (' . 'SELECT oecf.id FROM oro_entity_config_field AS oecf ' . 'WHERE oecf.field_name IN (:field_names) ' . 'AND oecf.entity_id = (' . 'SELECT oec.id FROM oro_entity_config AS oec WHERE oec.class_name = :class_name' . '))', ['field_names' => ['precision', 'currency'], 'class_name' => 'Oro\\Bundle\\OrganizationBundle\\Entity\\Organization'], ['field_names' => Connection::PARAM_STR_ARRAY, 'class_name' => Type::STRING]));
$queries->addPostQuery(new ParametrizedSqlMigrationQuery('DELETE FROM oro_entity_config_field ' . 'WHERE field_name IN (:field_names) ' . 'AND entity_id IN (' . 'SELECT id FROM oro_entity_config WHERE class_name = :class_name' . ')', ['field_names' => ['precision', 'currency'], 'class_name' => 'Oro\\Bundle\\OrganizationBundle\\Entity\\Organization'], ['field_names' => Connection::PARAM_STR_ARRAY, 'class_name' => Type::STRING]));
}
}
示例4: testPostGenerateSchema
/**
* Tests the postGenerateSchema() method.
*/
public function testPostGenerateSchema()
{
$provider = $this->getProvider(['tl_files' => ['TABLE_FIELDS' => ['path' => "`path` varchar(1022) NOT NULL default ''"]]]);
$schema = new Schema();
$event = new GenerateSchemaEventArgs($this->getMock('Doctrine\\ORM\\EntityManagerInterface'), $schema);
$this->assertFalse($schema->hasTable('tl_files'));
$listener = new DoctrineSchemaListener($provider);
$listener->postGenerateSchema($event);
$this->assertTrue($schema->hasTable('tl_files'));
$this->assertTrue($schema->getTable('tl_files')->hasColumn('path'));
}
示例5: acceptForeignKey
/**
* {@inheritdoc}
*/
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
{
// The table may already be deleted in a previous
// RemoveNamespacedAssets#acceptTable call. Removing Foreign keys that
// point to nowhere.
if (!$this->schema->hasTable($fkConstraint->getForeignTableName())) {
$localTable->removeForeignKey($fkConstraint->getName());
return;
}
$foreignTable = $this->schema->getTable($fkConstraint->getForeignTableName());
if (!$foreignTable->isInDefaultNamespace($this->schema->getName())) {
$localTable->removeForeignKey($fkConstraint->getName());
}
}
示例6: configureSchema
/**
* @return \Doctrine\DBAL\Schema\Table|null
*/
public static function configureSchema(Schema $schema)
{
if ($schema->hasTable(static::TABLE)) {
return null;
}
return static::configureTable();
}
示例7: up
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
$relationTableName = $this->nameGenerator->generateManyToManyJoinTableName('Oro\\Bundle\\EmailBundle\\Entity\\Email', ExtendHelper::buildAssociationName('OroCRM\\Bundle\\SalesBundle\\Entity\\B2bCustomer', ActivityScope::ASSOCIATION_KIND), 'OroCRM\\Bundle\\SalesBundle\\Entity\\B2bCustomer');
if (!$schema->hasTable($relationTableName)) {
$this->activityExtension->addActivityAssociation($schema, 'oro_email', 'orocrm_sales_b2bcustomer');
}
}
示例8: up
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
// this up() migration is auto-generated, please modify it to your needs
if (!$schema->hasTable(self::NAME)) {
return true;
}
$app = \Eccube\Application::getInstance();
$em = $app["orm.em"];
$CsvType = new CsvType();
$CsvType->setId(1);
$CsvType->setName('商品CSV');
$CsvType->setRank(3);
$em->persist($CsvType);
$CsvType = new CsvType();
$CsvType->setId(2);
$CsvType->setName('会員CSV');
$CsvType->setRank(4);
$em->persist($CsvType);
$CsvType = new CsvType();
$CsvType->setId(3);
$CsvType->setName('受注CSV');
$CsvType->setRank(1);
$em->persist($CsvType);
$CsvType = new CsvType();
$CsvType->setId(4);
$CsvType->setName('配送CSV');
$CsvType->setRank(2);
$em->persist($CsvType);
$CsvType = new CsvType();
$CsvType->setId(5);
$CsvType->setName('カテゴリCSV');
$CsvType->setRank(5);
$em->persist($CsvType);
$em->flush();
}
示例9: preUp
/**
* @param Schema $schema
*
* @throws SkipMigrationException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function preUp(Schema $schema)
{
if ($schema->hasTable($this->prefix . 'sms_messages')) {
throw new SkipMigrationException('Schema includes this migration');
}
$this->keys = ['sms_messages' => ['idx' => ['category' => $this->generatePropertyName('sms_messages', 'idx', ['category_id'])], 'fk' => ['category' => $this->generatePropertyName('sms_messages', 'fk', ['category_id'])]], 'sms_message_stats' => ['idx' => ['sms' => $this->generatePropertyName('sms_message_stats', 'idx', ['sms_id']), 'lead' => $this->generatePropertyName('sms_message_stats', 'idx', ['lead_id']), 'list' => $this->generatePropertyName('sms_message_stats', 'idx', ['list_id']), 'ip' => $this->generatePropertyName('sms_message_stats', 'idx', ['ip_id'])], 'fk' => ['sms' => $this->generatePropertyName('sms_message_stats', 'fk', ['sms_id']), 'lead' => $this->generatePropertyName('sms_message_stats', 'fk', ['lead_id']), 'list' => $this->generatePropertyName('sms_message_stats', 'fk', ['list_id']), 'ip' => $this->generatePropertyName('sms_message_stats', 'fk', ['ip_id'])]], 'sms_message_list_xref' => ['idx' => ['sms' => $this->generatePropertyName('sms_message_list_xref', 'idx', ['sms_id']), 'leadlist' => $this->generatePropertyName('sms_message_list_xref', 'idx', ['leadlist_id'])], 'fk' => ['sms' => $this->generatePropertyName('sms_message_list_xref', 'fk', ['sms_id']), 'leadlist' => $this->generatePropertyName('sms_message_list_xref', 'fk', ['leadlist_id'])]]];
}
示例10: addToSchema
/**
* @param Schema $schema
* @param string $table
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public static function addToSchema(Schema $schema, $table)
{
if ($schema->hasTable($table)) {
$table = $schema->getTable($table);
} else {
$table = $schema->createTable($table);
}
if (!$table->hasColumn('event_id')) {
$id = $table->addColumn('event_id', 'integer', ['unsigned' => true]);
$id->setAutoincrement(true);
$table->setPrimaryKey(['event_id']);
}
if (!$table->hasColumn('aggregate_id')) {
$table->addColumn('aggregate_id', 'string', ['length' => 50]);
}
if (!$table->hasColumn('version')) {
$table->addColumn('version', 'integer');
}
if (!$table->hasColumn('type')) {
$table->addColumn('type', 'string', ['length' => 100]);
}
if (!$table->hasColumn('payload')) {
$table->addColumn('payload', 'text');
}
if (!$table->hasColumn('recorded_on')) {
$table->addColumn('recorded_on', 'string', ['length' => 50]);
}
$table->addUniqueIndex(['aggregate_id', 'version']);
}
示例11: configureSchema
/**
* @param Schema $schema
*
* @return \Doctrine\DBAL\Schema\Table
*/
public function configureSchema(Schema $schema)
{
if ($schema->hasTable($this->tableName)) {
return null;
}
return $this->configureTable();
}
示例12: up
/**
* {@inheritdoc}
*/
public function up(Schema $schema, QueryBag $queries)
{
if ($schema->hasTable('oro_process_definition')) {
$queries->addQuery(new ParametrizedSqlMigrationQuery('DELETE FROM oro_process_definition WHERE name = :name', ['name' => 'email_auto_response']));
$queries->addQuery(new ParametrizedSqlMigrationQuery('DELETE FROM oro_process_trigger WHERE definition_name = :name', ['name' => 'email_auto_response']));
}
}
示例13: preUp
/**
* @param Schema $schema
*
* @throws SkipMigrationException
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function preUp(Schema $schema)
{
if ($schema->hasTable($this->prefix . 'push_notifications')) {
throw new SkipMigrationException('Schema includes this migration');
}
$this->keys = array('push_notifications' => array('idx' => array('category' => $this->generatePropertyName('push_notifications', 'idx', array('category_id'))), 'fk' => array('category' => $this->generatePropertyName('push_notifications', 'fk', array('category_id')))), 'push_notification_stats' => array('idx' => array('notification' => $this->generatePropertyName('push_notification_stats', 'idx', array('notification_id')), 'lead' => $this->generatePropertyName('push_notification_stats', 'idx', array('lead_id')), 'list' => $this->generatePropertyName('push_notification_stats', 'idx', array('list_id')), 'ip' => $this->generatePropertyName('push_notification_stats', 'idx', array('ip_id'))), 'fk' => array('notification' => $this->generatePropertyName('push_notification_stats', 'fk', array('notification_id')), 'lead' => $this->generatePropertyName('push_notification_stats', 'fk', array('lead_id')), 'list' => $this->generatePropertyName('push_notification_stats', 'fk', array('list_id')), 'ip' => $this->generatePropertyName('push_notification_stats', 'fk', array('ip_id')))), 'push_ids' => array('idx' => array('lead' => $this->generatePropertyName('push_ids', 'idx', array('lead_id'))), 'fk' => array('lead' => $this->generatePropertyName('push_ids', 'fk', array('lead_id')))), 'push_notification_list_xref' => array('idx' => array('notification' => $this->generatePropertyName('push_notification_list_xref', 'idx', array('notification_id')), 'leadlist' => $this->generatePropertyName('push_notification_list_xref', 'idx', array('leadlist_id'))), 'fk' => array('notification' => $this->generatePropertyName('push_notification_list_xref', 'fk', array('notification_id')), 'leadlist' => $this->generatePropertyName('push_notification_list_xref', 'fk', array('leadlist_id')))));
}
示例14: up
/**
* Attributes table was not used in the code anymore so can be removed
*
* @param Schema $schema
*/
public function up(Schema $schema)
{
$prefixedTableName = $this->getTablePrefix() . 'attribute';
if ($schema->hasTable($prefixedTableName)) {
$schema->dropTable($prefixedTableName);
}
}
示例15: oroCrmCreateTaskTable
/**
* @param Schema $schema
*/
protected function oroCrmCreateTaskTable(Schema $schema)
{
if ($schema->hasTable($this->taskTableName)) {
$schema->dropTable($this->taskTableName);
}
$table = $schema->createTable($this->taskTableName);
$table->addColumn('id', 'integer', ['autoincrement' => true]);
$table->addColumn('subject', 'string', ['notnull' => false, 'length' => 255]);
$table->addColumn('description', 'string', ['notnull' => false, 'length' => 255]);
$table->addColumn('due_date', 'datetime');
$table->addColumn('task_priority_name', 'string', ['notnull' => false, 'length' => 32]);
$table->addColumn('owner_id', 'integer', ['notnull' => false]);
$table->addColumn('related_account_id', 'integer', ['notnull' => false]);
$table->addColumn('related_contact_id', 'integer', ['notnull' => false]);
$table->addColumn('reporter_id', 'integer', ['notnull' => false]);
$table->addColumn('workflow_item_id', 'integer', ['notnull' => false]);
$table->addColumn('workflow_step_id', 'integer', ['notnull' => false]);
$table->addColumn('createdAt', 'datetime');
$table->addColumn('updatedAt', 'datetime', ['notnull' => false]);
$table->setPrimaryKey(['id']);
$table->addIndex(['task_priority_name'], 'IDX_814DEE3FD34C1E8E', []);
$table->addIndex(['owner_id'], 'IDX_814DEE3F7E3C61F9', []);
$table->addIndex(['related_account_id'], 'IDX_814DEE3FE774F01D', []);
$table->addIndex(['related_contact_id'], 'IDX_814DEE3FD6204081', []);
$table->addIndex(['reporter_id'], 'IDX_814DEE3FE1CFE6F5', []);
$table->addIndex(['due_date'], 'task_due_date_idx');
$table->addUniqueIndex(['workflow_item_id'], 'UNIQ_814DEE3F1023C4EE');
$table->addIndex(['workflow_step_id'], 'IDX_814DEE3F71FE882C', []);
$this->oroCrmCreateTaskTableForeignKeys($schema);
}