【发布时间】:2011-03-03 14:39:12
【问题描述】:
顺便说一句,我正在使用 zendframework、doctrine 1.2 和 MYSQL
//错误
消息:SQLSTATE[23000]:完整性约束违规:1452 无法添加或更新子行:外键约束失败(gepm2.Regions,约束Regions_id_Districts_regions_id外键(id)参考Districts( regions_id))
问题是我将数据存储到 Regions 表中,这些区域的值 [ 身份证:AR, 名称:测试名称, Country_id:英国]
enter code here
##YAML
Country:
tableName: Countries
columns:
id:
type: string(3)
fixed: true
primary: true
notnull: true
name:
type: string(45)
default: null
currency:
type: string(3)
fixed: true
default: null
Region:
tableName: Regions
columns:
id:
type: string(2)
fixed: true
primary: true
notnull: true
name:
type: string(45)
default: null
Countries_id:
type: string(3)
fixed: true
primary: true
notnull: true
relations:
country:
class: Country
local: Countries_id
foreign: id
foreignAlias: regions
foreignType: many
owningSide: true
indexes:
fk_Regions_Countries:
fields: [Countries_id]
District:
tableName: Districts
columns:
id:
type: string(3)
fixed: true
primary: true
notnull: true
name:
type: string(45)
default: null
Regions_id:
type: string(2)
fixed: true
primary: true
notnull: true
relations:
region:
class: Region
local: Regions_id
foreign: id
foreignAlias: districts
foreignType: many
owningSide: true
indexes:
fk_Districts_Regions1:
fields: [Regions_id]
【问题讨论】:
标签: mysql