Home [Postgres][Doctrine][Symfony 3] boolean and nullable issue
Reply: 1

[Postgres][Doctrine][Symfony 3] boolean and nullable issue

Younes Diouri
1#
Younes Diouri Published in 2017-09-13 14:06:43Z

I'm stuck with the following problem : I'm setting a new boolean parameter into my entity,

/**
 * @var boolean
 *
 * @ORM\Column(type="boolean", nullable=false)
 */
private $tester = false;

here, the tester has to be set to false, but I get the following error when I try the -f :

[PDOException] SQLSTATE[23502]: Not null violation: 7 ERREUR: « tester » column got NULL values

Thank you very much for your help.

Barkati.med
2#
Barkati.med Reply to 2017-09-13 14:42:23Z

Hi The New boolean field can't be null so you have to make a default value true or false so change your code to

/**
 * @var boolean
 *
 * @ORM\Column(type="boolean", nullable=false,options={"default":false})
 */
  private $tester;
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.307868 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO