在 appDevDebugProjectContainer.php 中找不到 Symfony 2 错误 class
Symfony 2 error class not found in appDevDebugProjectContainer.php
我想添加具有安全上下文的表单服务,如下所示:
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: 错误: Class 'Infogold\AccountBundle\Form\KonsulantType' 未在 D:\xampp\htdocs\symfony4\app\cache\dev\appDevDebugProjectContainer.php 行 718
中找到
718行是:
protected function getForm_Type_KonsultanciFormService()
{
return $this->services['form.type.konsultanci_form'] = new \Infogold\AccountBundle\Form\KonsulantType($this->get('security.context'));
}
我哪里弄错了?
正如我所说,class 名称是错误的。它是 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 }
我想添加具有安全上下文的表单服务,如下所示:
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: 错误: Class 'Infogold\AccountBundle\Form\KonsulantType' 未在 D:\xampp\htdocs\symfony4\app\cache\dev\appDevDebugProjectContainer.php 行 718
中找到718行是:
protected function getForm_Type_KonsultanciFormService()
{
return $this->services['form.type.konsultanci_form'] = new \Infogold\AccountBundle\Form\KonsulantType($this->get('security.context'));
}
我哪里弄错了?
正如我所说,class 名称是错误的。它是 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 }