Symfony1 我能';t执行数据加载(Symfony 1.4原则)
我的symfony项目有些问题。Symfony1 我能';t执行数据加载(Symfony 1.4原则),symfony1,doctrine,symfony-1.4,fixtures,data-dump,Symfony1,Doctrine,Symfony 1.4,Fixtures,Data Dump,我的symfony项目有些问题。 我有一个带有InnoDB表的MySQL数据库。 我尝试创建简单的树菜单: schema.yml Menu: actAs: Timestampable: created: disabled: true updated: disabled: true columns: id: { type: integer, autoincrement: true, notnull: true, pri
我有一个带有InnoDB表的MySQL数据库。
我尝试创建简单的树菜单: schema.yml
Menu:
actAs:
Timestampable:
created:
disabled: true
updated:
disabled: true
columns:
id: { type: integer, autoincrement: true, notnull: true, primary: true }
name: { type: string(255), notnull: true }
parent: { type: integer, notnull: false }
relations:
Parent:
alias: parentItem
foreignAlias: childrens
class: Menu
local: parent
foreign: id
type: many-to-one
onDelete: CASCADE
在后端创建元素后,我执行data:dump
并获取此代码
固定装置:
Menu:
Menu_1:
name: 'Parent'
Menu_2:
parentItem: Menu_1
name: 'Children'
如果我尝试跑步,我已经失去了项目之间的关系
我不明白怎么了
编辑:
之前:
| id | name | parent |
| 1 | Parent | NULL |
| 2 | Children | 1 |
之后
我认为关系的类型是一种,关系的类型是多种多样的:
Menu:
actAs:
Timestampable:
created:
disabled: true
updated:
disabled: true
columns:
id: { type: integer, autoincrement: true, notnull: true, primary: true }
name: { type: string(255), notnull: true }
parent: { type: integer, notnull: false }
relations:
Parent:
alias: parentItem
class: Menu
local: parent
foreign: id
type: one
foreignAlias: childrens
foreignType: many
onDelete: CASCADE
我认为关系的类型是一种,关系的类型是多种多样的:
Menu:
actAs:
Timestampable:
created:
disabled: true
updated:
disabled: true
columns:
id: { type: integer, autoincrement: true, notnull: true, primary: true }
name: { type: string(255), notnull: true }
parent: { type: integer, notnull: false }
relations:
Parent:
alias: parentItem
class: Menu
local: parent
foreign: id
type: one
foreignAlias: childrens
foreignType: many
onDelete: CASCADE
你所说的失去关系是什么意思?@j0k之前:
|id | name | parent |
|1 | parent | NULL |
|id | name | parent |
|1 | parent | NULLӘChildren。我在parent-col中丢失了一个a值。对我来说,它变成了一个0井,因为您使用parentItem
和父项的键引用了关系,所以一切似乎都正常。奇怪..@j0k我试着使用parent。没有变化。(你所说的失去关系是什么意思?@j0k之前:|id | name | parent |
|1 | parent | NULL |
|id | name | parent | | parent | NULL | |
|1 | parent | NULL | Children这对我来说是一个很好的例子,因为您使用parentItem
引用了关系,并使用了父项的键。奇怪..@j0k我尝试使用parent。没有更改(