I have a pretty standard Entity with the correct imports:
/**
* Budhaz\aMailerBundle\Entity\Instance
*
* @ORM\Table()
* @ORM\Entity
*/
class Instance {
use TimestampableEntity;
/** @ORM\Id @ORM\GeneratedValue @ORM\Column(type="integer") */
private $id;
...
}
But I would like to remove the createdAt (and updatedAt) from my form so the user don't and can't set them, so I remove it from the InstanceForm:
class InstanceType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('startAt')
->add('endAt')
//->add('createdAt')
//->add('updatedAt')
->add('campaign')
;
}
...
}
But now I have this error:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'createdAt' cannot be null
createdAt and updatedAt should automaticaly be set by Doctrine, but it stays null, anyone know why?