Skip to content
Advertisement

symfony entities many to many, i add new fields

I try this code: Symfony: ManyToMany table extra columns

This new field is because the user have a diferent role for diferent events.

In the fist time i can add add the new fields on table user.evento, but now i cant. And i dont find the problem.

I get this fail:

An exception occurred while executing ‘INSERT INTO user_evento (user_id, evento_id) VALUES (?, ?)’ with params [3, 18]: SQLSTATE[HY000]: General error: 1364 Field ‘tipoinvitado’ doesn’t have a default value

why not detecting the other 2 fields ?

capture of my sql update with the new fields

capture

my entity UserHasEvento:

JavaScript

My controller update.

JavaScript

Advertisement

Answer

Is your field $tipoinvitado disappear? You might have changed your relation and the null boolean of $tipoinvitado at some point. You made your migration after changing any relation?

This can happen when you change your relations and had already data stored in you DB in a field that disappear because of you relation change.

I might be able to help you, don’t hesitate giving more info

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement