简体   繁体   English

Symfony2,Doctrine2和PostgreSQL:错误“未定义的变量:className”

[英]Symfony2, Doctrine2 and PostgreSQL: error “Undefined variable: className”

I try to configure entities for existing table in PostgreSQL database. 我尝试为PostgreSQL数据库中的现有表配置实体。 Sequences in this database have names other than default doctrine names, so i have to account that in entity. 此数据库中的序列具有默认教义名称以外的名称,因此我必须在实体中进行说明。

Webclient\db\LoginBundle\Entity\WebclientUsers:
type: entity
table: webclient.t_webclientusers
fields:
  id:
    type: integer
    generator:
      strategy: AUTO
    sequenceGenerator:
      sequenceName: webclient.s_webclientusers_id
  email:
    type: text
lifecycleCallbacks: {  }

I tried also other strategy configurations, but i still having error: 我也尝试了其他策略配置,但仍然有错误:

Notice: Undefined variable: className in ****\Symfony\vendor\doctrine\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php line 343

What can I do with that? 我该怎么办?

I found an aswer on another website: 我在另一个网站上找到了一个请求者:

This is a internal error of Doctrine2, this bug is now fixed but if not : 这是Doctrine2的内部错误,此错误现在已修复,但如果未解决:

http://www.doctrine-project.org/jira/browse/DDC-1381 http://www.doctrine-project.org/jira/browse/DDC-1381

Just edit the file ClassMetadataFactory.php and replace $className by $class->name on line 343, it will fix the problem. 只需编辑文件ClassMetadataFactory.php并在第343行用$ class-> name替换$ className,它将解决此问题。

You will probably get another error but this time, this will come from ur app. 您可能会遇到另一个错误,但这一次,这将来自您的应用程序。

Regards. 问候。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM