本文介绍了doctrine:构建模式忽略表列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为标题的表,其 SHOW CREATE TABLE 如下所示:

I have a table called heading whose SHOW CREATE TABLE looks like this:

CREATE TABLE `heading` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `referenced_table_name` varchar(255) NOT NULL,
  `column_name` varchar(255) NOT NULL,
  `label` varchar(255) NOT NULL,
  `position` int(10) unsigned NOT NULL,
  `import_profile_id` bigint(20) NOT NULL,
  `note` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  UNIQUE KEY `referenced_table_name` (`referenced_table_name`,`column_name`,`position`,`import_profile_id`),
  KEY `import_profile_id` (`import_profile_id`),
  CONSTRAINT `heading_ibfk_1` FOREIGN KEY (`import_profile_id`) REFERENCES `import_profile` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=847 DEFAULT CHARSET=latin1

如你所见,它有一些列。这是什么原则:构建模式是将这个表突然变成(过去工作正常):

As you can see, it has some columns. Here's what doctrine:build-schema is all the sudden transforming this table into (it worked fine in the past):

Heading:
  connection: doctrine
  tableName: heading
  columns: {  }
  relations:
    ImportProfile:
      local: import_profile_id
      foreign: id
      type: one
    TotalFromFile:
      local: id
      foreign: heading_id
      type: many

没有列。 WTF?由于某种原因,只有这个表这样做,现在才发生。这是一张老表!任何想法?

No columns. WTF? For some reason, ONLY this table does this and it's only happening now. This is an old table! Any ideas?

我在LAMP上使用了symfony 1.4和Doctrine 1.2。

I'm using MySQL on LAMP with symfony 1.4 and Doctrine 1.2.

推荐答案

结果是,我已经定义了 HeadingTable :: getTables() HeadingTable :: getColumns() code>。原则不是那样。

Turns out the problem was that I had defined HeadingTable::getTables() and HeadingTable::getColumns(). Doctrine didn't like that.

这篇关于doctrine:构建模式忽略表列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 03:31