I have an entity called Step2 (has multiple selectedriskassesments entities which is a RiskAssestment entity with an extra field):
......................
manyToMany:
selectedriskassesments:
targetEntity: **SelectedRiskAssesment**
joinTable:
name: step2_selected_risk_assesments
joinColumns:
step2_id:
referencedColumnName: id
inverseJoinColumns:
selected_risk_id:
referencedColumnName: id
cascade: ["persist","remove"]
..............................
and SelectedRiskAssesment entity has:
manyToOne:
risk_assesment:
targetEntity: RiskAssestment
inversedBy: selectedriskassesment
joinColumn:
name: risk_assesment
referencedColumnName: id
orphanRemoval: true
This is part of a survey, and I want to delete Step2 entity and it`s selectedriskassesments but I get :
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`phsafety`.`step2_selected_risk_assesments`, CONSTRAINT `FK_FAFC9298EA71C84F` FOREIGN KEY (`selected_risk_id`) REFERENCES `selectedriskassesment` (`id`))
I have tried to use orphanRemoval: true to unbind from the RiskAssestment entity...any help would be awesome