2 대다 관계 (2 중간 테이블)을 생성, 내가 같은 테이블에 둘 다 대다 관계를 만들어야합니다. 나는 설명한다 : 나는 2 개의 테이블이있다; Monitor 테이블과 서버는 중간 테이블을 여러 개의 테이블로 연결하는 것을 "벤치 마크"라고합니다. 그러나 동시에 나는 그래서 여기 내가 무슨 짓을했는지이다 (표는 "Url_ip"이라고합니다) 서버에서 여러 개의 IP 년대에 부부에 모니터에서 URL을 날 수 있도록 할 수있는 또 다른 중간 테이블을 가지고 있습니다교리/심포니 : 같은 두 테이블 내 매우 "희귀"경우
Monitor:
tableName: monitor
actAs:
Timestampable: ~
columns:
id : {type: integer(4), primary: true, autoincrement: true}
label: {type: string(45)}
url: {type: string(80)}
frequency: {type: integer}
timeout: {type: integer}
method: {type: enum, values: [GET, POST]}
parameters: {type: string(255)}
relations:
Groups:
class: Groups
local: monitor_id
foreign: sf_guard_group_id
refClass: Alert
Server:
class: Server
local: monitor_id
foreign: server_id
refClass: Benchmark
Server2:
class: Server
local: monitor_id
foreign: server_id
foreignAlias: Ips
refClass: Url_ip
Url_ip:
actAs:
Timestampable: ~
columns:
monitor_id: { type: integer(4), primary: true }
server_id: { type: integer(4), primary: true }
relations:
Monitor:
foreignAlias: IpUrls
Server:
foreignAlias: IpUrls
Benchmark:
tableName: benchmark
actAs:
Timestampable: ~
columns:
monitor_id: { type: integer(4), primary: true }
server_id: { type: integer(4), primary: true }
connexionTime: {type: string(45)}
executionTime: {type: string(45)}
responseTime: {type: string(45)}
responseCode: {type: string(45)}
responseMessage: {type: string(45)}
relations:
Monitor:
foreignAlias: ServerMonitors
Server:
foreignAlias: ServerMonitors
Server:
tableName: server
actAs:
TimeStampable: ~
columns:
id : {type: integer(4), primary: true,autoincrement: true}
name: {type: string(255)}
ip: {type: string(45)}
relations:
Monitor:
class: Monitor
local: server_id
foreign: monitor_id
refClass: Benchmark
Monitor2:
class: Monitor
foreignAlias: monitors
local: server_id
foreign: monitor_id
refClass: Url_ip
Alert:
actAs:
Timestampable: ~
columns:
monitor_id: { type: integer(4), primary: true }
sf_guard_group_id: { type: integer, primary: true }
relations:
Monitor:
foreignAlias: GroupMonitors
sfGuardGroup:
foreignAlias: GroupMonitors
사실이 교리는 해당 테이블을 생성 할 수 있기 때문에 작업이 나타납니다. 문제는 fixure를로드하는 중입니다./alerts.yml
Alert:
alert_a:
monitor_id: 1
sf_guard_group_id: 1
alert_b:
monitor_id: 2
sf_guard_group_id: 2Alert:
alert_a:
monitor_id: 1
sf_guard_group_id: 1
alert_b:
monitor_id: 2
sf_guard_group_id: 2
HELP를
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a c
hild row: a foreign key constraint fails (`sfmonitoring`.`alert`, CONSTRAINT `al
ert_monitor_id_monitor_id` FOREIGN KEY (`monitor_id`) REFERENCES `monitor` (`id`
))
fixures/monitors.yml
Monitor:
monitor_one:
id: 1
label: task1
url: www.task1.com
frequency: 5
timeout: 30
method: GET
parameters: a=1&b=2
monitor_two:
id: 2
label: task2
url: www.task2.com
frequency: 5
timeout: 20
method: POST
parameters: a=11&b=22
monitor_three:
id: 3
label: task3
url: www.task3.com
frequency: 10
timeout: 30
method: GET
parameters: a=111&b=211
fixures/benchmark.yml
Benchmark:
bench_one:
monitor_id: 1
server_id: 1
connexionTime: 25
executionTime: 25
responseTime: 25
responseCode: 200
responseMessage: message de réponse
bench_two:
monitor_id: 2
server_id: 2
connexionTime: 25
executionTime: 25
responseTime: 25
responseCode: 200
responseMessage: message de réponse
bench_three:
monitor_id: 3
server_id: 3
connexionTime: 25
executionTime: 25
responseTime: 25
responseCode: 200
responseMessage: message de réponse
bench_Four:
monitor_id: 1
server_id: 2
connexionTime: 25
executionTime: 25
responseTime: 25
responseCode: 200
responseMessage: message de réponse
fixures - :이 오류가 --------> SOS
내 질문을 수정하고 알림 구조를 추가했습니다. alert_a : 모니터 : monitor_one 그룹 : 그것을 – ProXamer
을 읽어 보시기 바랍니다 내가이 짓 Group_admin – ProXamer
을하지만 난이 오류가 : 클래스에 언급 된 "(경고) alert_a"가 "그룹"과 "sfGuard 그룹"이 될 것으로 예상된다이었다 주어진 – ProXamer