开发者

Fatal error: Class 'Symfony\Component\Form' not found

开发者 https://www.devze.com 2023-02-15 00:55 出处:网络
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

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(
    开发者_如何学JAVA           new TextField('name',
                               array('max_length' => 100,
                                   'required' => true
                                   )
                         )
              );
        $this->add(
               new EmailField('email',
                               array('max_length' => 100,
                                   'required' => true
                                   )
                         )
              );
    }
}


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消