0

I am using Symfony 2.8 with doctrine. I have entity with 3 properties. I would like to save form in database but only with 1 property. I created a form with 1 property but when I am trying to save it, error is shown:

An exception occurred while executing INSERT INTO human (name, age, eyes) VALUES (?, ?, ?) with params ["ss", null, null]:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'age' cannot be null

Is it possible to do? I tried to set 'mapped'=> false option to underirable properties but it is not working.

Thank you for help in advance.

Andrew
  • 1,858
  • 13
  • 15
michau85
  • 27
  • 7
  • It is database issue, the column age is specified as NOT NULL. You need to ALTER this column so NULL values are allowed. Here's how: http://stackoverflow.com/questions/212939/how-do-i-modify-a-mysql-column-to-allow-null – Miro May 16 '16 at 18:23
  • 1
    `php bin/console doctrine:schema:update` – malcolm May 16 '16 at 19:48

0 Answers0