类“AppBundle \ Entity \ User”中不存在属性“identifier”

时间:2016-07-30 16:02:56

标签: php forms symfony symfony-forms symfony-2.8

我正在努力让用户注册表格在Symfony-2.8中工作,并且一直在关注KNP大学的内容。我已经设置了用户实体,UserFormType并创建了带有视图的UserController。渲染表单时,一切正常。它使用CSRF令牌等完美呈现。问题是我提交表单时。显示的错误是: Property "identifier" does not exist in class "AppBundle\Entity\User"一个ValidatorException。搜索谷歌并没有带来任何东西,这让我相信它的简单。

实际日志错误:

[2016-07-30 17:41:52] request.CRITICAL:
    Uncaught PHP Exception Symfony\Component\Validator\Exception\ValidatorException:
    "Property "identifier" does not exist in class "AppBundle\Entity\User"" at 
/var/projects/clients/perfect.symfony-2x.dev/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php line 42 
{
    "exception":"[object] (Symfony\\Component\\Validator\\Exception\\ValidatorException(code: 0):
    Property \"identifier\" does not exist in class \"AppBundle\\Entity\\User\" at
    /var/projects/clients/perfect.symfony-2x.dev/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php:42)"
} []

在despiration中,我删除了我的代码并复制并粘贴了Symfony示例中的代码,但我仍然遇到了同样的错误。你可以在这里找到Symfony的例子:

https://symfony.com/doc/2.8/doctrine/registration_form.html

任何人都可以解释在哪里解决这个问题。就我而言,谷歌并没有太大的帮助:(

0 个答案:

没有答案