yamlとデータフィクスチャでデータベースマークアップを作成する方法について詳しく知ることができます。
私はチュートリアルに従い、ユーザーと車の両方の関係の下で、次のような関係を作成します。私のqnは、Carで「type:many」である理由です。代わりにユーザーに含めることはできますか(興味があります)?
abtデータ型。データベースが異なれば、データベースのサポートも異なります。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(Character Large OBject)ですか?–iceangel890秒前[このコメントを削除]
ForeignAliasとは何ですか?エイリアスもありますか?
更新2
これは少し長くなります。DoctrineYAMLスキーマファイルのドキュメントページにあるコード例のいくつかを明確にしたいと思います。関係セクションに焦点を当てる->//コメント
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