What is "$this->get('form.context')" and where it set?

On 8 Лют, 20:23, Nikita Korotaev <[email protected]> wrote:
> Bernhard, thanks for your suggestion. After playing around with different
> configurations, I've finally made it working.
>
>         // Code in controller
>      $relationUserUniversity = new RelationUserUniversity();
>      $relationUserUniversity->setUser(new User());
>      $relationUserUniversity->setUniversity(new University());
>         $form =
> UniversityRegistrationForm::create($this->get('form.context'),
> 'Registration');
>         $form->bind($this->get('request'), $relationUserUniversity);
>
> class UniversityRegistrationForm extends Form
> {
>     protected function configure()
>     {
>      $user = new Form('User');
>      $user->add(new TextField('firstName'));
>      $user->add(new TextField('lastName'));
>      $user->add(new TextField('email'));
>      $user->add(new RepeatedField(new PasswordField('password')));
>      $this->add($user);
>      $university = new Form('University');
>      $university->add(new TextField('name'));
>      $this->add($university);
>
>     }
>
> }
>
> Thanks for help,
> Nikita

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to