Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/248.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在AppDevDebBugProjectContainer.php中找不到Symfony 2错误类_Php_Symfony - Fatal编程技术网

在AppDevDebBugProjectContainer.php中找不到Symfony 2错误类

在AppDevDebBugProjectContainer.php中找不到Symfony 2错误类,php,symfony,Php,Symfony,我想添加具有安全上下文的表单服务,如下所示: namespace Infogold\AccountBundle\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; use Symfony\Component\Security\Co

我想添加具有安全上下文的表单服务,如下所示:

namespace Infogold\AccountBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Security\Core\SecurityContext;
use Doctrine\ORM\EntityRepository;

class KonsultantType extends AbstractType {

     protected $user;

    public function __construct(SecurityContext $user) {


        $this->user = $user;
    }
 public function buildForm(FormBuilderInterface $builder, array $options) {
    -
    -
    -
    -
    -
    -
  public function getName() {
        return 'konsultanci_form';
    }
在职:

parameters:
#    infogold_account.example.class: Infogold\AccountBundle\Example

services:

   form.type.konsultanci_form:
       class:  Infogold\AccountBundle\Form\KonsulantType
       arguments: ['@security.context'] 
       tags:
            - { name: form.type, alias: konsultanci_form }  
我得到了这个错误:

FatalErrorException:错误:在D:\xampp\htdocs\symfony4\app\cache\dev\appDevDebugProjectContainer.php第718行中找不到类“Infogold\AccountBundle\Form\konsulantype”

718行是:

protected function getForm_Type_KonsultanciFormService()
    {
        return $this->services['form.type.konsultanci_form'] = new \Infogold\AccountBundle\Form\KonsulantType($this->get('security.context'));
    }

我哪里出错了?

正如我所说,这是一个关于类名的错误。它是
KonsultantType
而不是
KonsultantType

尝试:


您创建了一个名为
KonsultantType
的类。在您的service.yml中,您将类设置为
Infogold\AccountBundle\Form\KonsulantType
。类名有点错误。在服务配置中指定名称空间是正常的,您是否刷新了缓存?使用缓存:清除命令?哦抱歉@marcoshoya我没有看到上面的错误classname@JonaPkr在类中,名称为KonsulTANTtype。在服务文件上,名称为KonsuLANTtype。再见;)是的,我没有看到错误类型,我以为你说的是名称空间被指定的事实。投票支持你:)
parameters:
#    infogold_account.example.class: Infogold\AccountBundle\Example

services:

   form.type.konsultanci_form:
       class:  Infogold\AccountBundle\Form\KonsultantType
       arguments: ['@security.context'] 
       tags:
            - { name: form.type, alias: konsultanci_form }