我在哪里可以了解更多关于在 yaml 和数据夹具中创建数据库标记的信息。
我遵循了一个教程,他们创建了这样的关系:在用户和汽车的关系下。我的 qn 是为什么 Car 中的“类型:很多”。我可以在用户中使用它吗(只是好奇)?
ab 数据类型。不同的数据库有不同的数据库支持。我认为在 MySQL 中(这里使用的 InnoDB)整数应该是 tinyint(x)、bigint(x)、int(x) ......或者字符串应该是 varchar 而不是字符串?我在这里使用什么不严格吗?
options:
type: INNODB
collate: utf8_general_ci
charset: utf8
User:
columns:
id:
type: integer
primary: true
autoincrement: true
name: string(300)
email: string(300)
phone: string(9)
car_id: integer
relations:
Car:
local: car_id
foreign: id
Car:
columns:
id:
type: integer
primary: true
autoincrement: true
brand: string(300)
relations:
Users:
class: User
foreign: car_id
local: id
type: many
更新 1
在我的示例中,“只需要在外键存在的末尾指定关系”,那将是?它们是指 FK 表(汽车)还是 FK 列(用户)?
我没有看到 TEXT 数据类型,是 clob(字符大对象)吗?– iceangel89 0 秒前 [删除此评论]
什么是外国别名?也有别名吗?
更新 2
这会有点长,我只想澄清Doctrine YAML Schema Files 文档页面中的一些代码示例。关注关系部分 -> 在 // 评论中
User:
columns:
username:
type: string(255)
password:
type: string(255)
contact_id:
type: integer
relations:
Contact:
class: Contact // if the table is named Contact, class will be Contact also?
local: contact_id
foreign: id
foreignAlias: User // whats alias for?
foreignType: one // one contact ... to ...
type: one // one user?
Contact:
columns:
first_name:
type: string(255)
last_name:
type: string(255)
phone:
type: string(255)
email:
type: string(255)
address:
type: string(255)
relations:
User:
class: User
local: id
foreign: contact_id
foreignAlias: Contact
foreignType: one
type: one
对于多对多的例子,以下是什么意思?
attributes:
export: all
validate: true
tableName: group_table
refClass: GroupUser