i am doing app, where i use SQL and i want to save checkbox values in one column. i am doing it like this:
/**
* @Assert\NotBlank(
* message="please select!")
* @Assert\NotNull(
* message="please select!")
* @Assert\Range(min=0, max=9)
* @ORM\Column(type="integer")
*/
protected $ingredients;
public static function getIngredientsOptions(){
return array('cheese','tomatoes','salami','onions','mushroom','bacon','ham','vegetables','peppers','olives');
}
but i get error which says that i have SELECT error, i think problem is with checkbox. is this correct? can you help me how to this ?
You can change the column type to "array" like this:
This will result in a longtext field with comment "(DC2Type:array)" so Doctrine knows how to handle it. It will store a serialized array.
This might be what you want. If not, please post some more code of your setter and controller where the form is used, as well as the error message.