symfony-formssymfony2

How to build custom symfony2 form?


I have three entities, fos_user, command and preference. The user can send himself an email containing a specific field from each entity, these fields can't be empty. So when the user decides to send the mail, he should update/fill these fields through a form before sending the email. The new values will only be sent through the email and won't be saved into the database.

How do I build this form with needed validators?


Solution

  • Found the anwser :), I'm working on something like this:

    $o = new \stdClass();
    $o->name = null;
    $o->command_name = null;
    $o->like_it = null;
    
    $form = $this->createFormBuilder....
    

    We can even use a table instead of stdClass object.