-2

When i'm creating form for user. It displaying below error

Fatal error: Class 'Symfony\Component\Form' not found in D:\wamp\www\sandbox\src\Sensio\HelloBundle\User\UserForm.php on line 7"

Below are the code of UserForm.php

<?php

use Symfony\Component\Form;
use Symfony\Component\Form\TextField;
use Symfony\Component\Form\EmailField;

class UserForm extends Form
{
    protected function configure()
    {
        $this->add(
               new TextField('name',
                               array('max_length' => 100,
                                   'required' => true
                                   )
                         )
              );
        $this->add(
               new EmailField('email',
                               array('max_length' => 100,
                                   'required' => true
                                   )
                         )
              );
    }
}
1

2 Answers 2

1

Replace 'use Symfony\Component\Form' by 'use Symfony\Component\Form\Form' (line 3).

0

If you are getting

Fatal error: Class 'UsersForm' not found in symfony

class contactActions extends sfActions
{
    public function executeIndex()
    {
        $this->form = new ContactForm();
    }
}

use below command :

$ php symfony cc

OR

$ php symfony cache:clear

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.