Fatal error: Class 'Symfony\Component\Form' not found
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
精彩评论