I have a database schema in Symfony:
Persona:
actAs: { Timestampable: ~ }
columns:
primer_nombre: { type: string(255), notnull: true }
segundo_nombre: { type: string(255) }
apellido: { type: string(255), notnull: true }
rut: { type: string(255) }
email: { type: string(255) }
email2: { type: string(255) }
direccion: { type: string(400) }
ciudad: { type: string(255) }
region: { type: string(255) }
pais: { type: string(255) }
telefono: { type: string(255) }
telefono2: { type: string(255) }
fecha_nacimiento: { type: date }
Alumno:
inheritance:
type: concrete
extends: Persona
columns:
comentario: { type: string(255) }
estado_pago: { type: string(255) }
Alumno_Beca:
columns:
persona_id: { type: integer, primary: true }
beca_id: { type: integer, primary: true }
relations:
Alumno: { onDelete: CASCADE, local: persona_id, foreign: id }
Beca: { onDelete: CASCADE, local: beca_id, foreign: id }
Beca:
columns:
nombre: { type: string(255) }
monto: { type: double }
porcentaje: { type: double }
descripcion: { type: string(5000) }
As you can see, alumno has a specific inheritance from persona. Now I am trying to create fixtures for these two tables, and I can not get Doctrine to load them. This gives me this error:
SQLSTATE [23000]: integrity constraint Violation: 1452 Unable to add or update child row: foreign key constraint failed ( eat/alumno__beca, CONSTRAINT alumno__beca_persona_id_alumno_idFOREIGN KEY ( persona_id) REFERENCES alumno( id) DELETE CASCADE)
Does anyone know how to write a fixture for a table inherited from another?
Thank!
source
share