This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

adding & validating of extra option a on entity form field

New topics about Symfony 2 should go here

adding & validating of extra option a on entity form field

by tonnebrre » Tue Jun 23, 2015 3:19 pm

helle every one
i am new in symfony and i want to do the following :

i have an entity reservation with a field chambre that reference the chambre entity (manyToMany) and i want the user to be able to choose an option "all" that mean reservation of all the chambres and store it in database.

i add the extra option "all" by the method :

Code: Select all
    public function finishView(FormView $view, FormInterface $form, array $options) {
        $new_choice = new ChoiceView(array(), 0, "All");
        $view->children["chambres"]->vars["choices"][] = $new_choice;
    }

if the user choose "all" the form is invalid

i released the field chambre, it render a select with multi attribute that work fine but how can i validate the extra option "all" and store it in db ?
tonnebrre
Junior Member
 
Posts: 1
Joined: Tue Jun 23, 2015 2:58 pm