教义列聚合继承
我正在尝试实现 Doctrine 列聚合继承
我从 Doctrine 指南 并将其粘贴到我的 schema.yml
文件中:
Entity:
columns:
username: string(20)
password: string(16)
created_at: timestamp
updated_at: timestamp
User:
inheritance:
extends: Entity
type: column_aggregation
keyField: type
keyValue: 1
Group:
inheritance:
extends: Entity
type: column_aggregation
keyField: type
keyValue: 2
但是当我使用 doctrine:build-model
时来自 symfony 命令行的 doctrine:build-sql
命令,我得到的 sql 文件包含两行类似的行用于创建 Entity
表:
CREATE TABLE entity (id BIGINT AUTO_INCREMENT, username VARCHAR(20), password VARCHAR(16), created_at DATETIME, updated_at DATETIME, type VARCHAR(255), INDEX entity_type_idx (type), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE entity (id BIGINT AUTO_INCREMENT, username VARCHAR(20), password VARCHAR(16), created_at DATETIME, updated_at DATETIME, type VARCHAR(255), PRIMARY KEY(id)) ENGINE = INNODB;
当我尝试导入时,这当然会导致错误它到我的数据库..
它是 Symfony 命令行中的内置错误吗?
I'm trying to implement Doctrine column-aggregation inheritance
I copied the Yaml structure from the Doctrine guide and paste it in my schema.yml
file:
Entity:
columns:
username: string(20)
password: string(16)
created_at: timestamp
updated_at: timestamp
User:
inheritance:
extends: Entity
type: column_aggregation
keyField: type
keyValue: 1
Group:
inheritance:
extends: Entity
type: column_aggregation
keyField: type
keyValue: 2
But when I use the doctrine:build-model
and doctrine:build-sql
commands from symfony's command line, the sql file I get contains two similar lines for creating the Entity
table:
CREATE TABLE entity (id BIGINT AUTO_INCREMENT, username VARCHAR(20), password VARCHAR(16), created_at DATETIME, updated_at DATETIME, type VARCHAR(255), INDEX entity_type_idx (type), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE entity (id BIGINT AUTO_INCREMENT, username VARCHAR(20), password VARCHAR(16), created_at DATETIME, updated_at DATETIME, type VARCHAR(255), PRIMARY KEY(id)) ENGINE = INNODB;
Which ofcourse causes an error when I try to import it to my database..
Is it a build-in bug in Symfony's command-line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,看起来这是一个报告的错误,而且它只能工作在教义 2 中
Well, it looks like it is a reported bug and it will only work in Doctrine 2