doctrine:build-schema ignoring table columns

2019-08-14 04:14发布

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

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

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

2条回答
地球回转人心会变
2楼-- · 2019-08-14 04:37

Jason, I think your problem may be related to the schema getting generated from a truncated temp file. See the question and my answer here:

Symfony doctrine:build-model errors

查看更多
在下西门庆
3楼-- · 2019-08-14 04:56

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

查看更多
登录 后发表回答