【问题标题】:Doctrine2 cannot load class with namespace through relationshipDoctrine2 无法通过关系加载具有命名空间的类
【发布时间】:2013-04-03 16:07:42
【问题描述】:

我有 2 个实体; BusinessContactInformation 和 ContactInformationTypes。 BusinessContactInformation 的一个实体始终属于给定的 ContactInformationType。

但是,当我尝试加载 BusinessContactInformation 类型的实体时,我收到以下错误:

致命错误:require(): 无法打开所需的 '/var/tmp//_CG_platformentitiesContactinformationtypes.php'

实体都在 \platform\entities 命名空间中,并且它们具有以下注释:

/**
 * Businesscontactinformation
 *
 * @Table(name="businessContactInformation")
 * @Entity
 */
(...)
/**
 * @var Contactinformationtypes
 *
 * @ManyToOne(targetEntity="Contactinformationtypes")
 * @JoinColumns({
 *   @JoinColumn(name="contactTypeId", referencedColumnName="id")
 * })
 */
private $contacttypeid;

和联系信息类型:

 /**
  * Contactinformationtypes
  *
  * @Table(name="contactInformationTypes")
  * @Entity
  */

有人知道是什么原因造成的吗?我的所有关系都有这个问题 - 一对多,多对一,...。

【问题讨论】:

    标签: php oop namespaces doctrine-orm


    【解决方案1】:

    我最终重新生成了我的实体和代理。它让我有一个适当的新开始,我必须在 Setup::createAnnotationMetadataConfiguration 中将我的代理作为第三个参数。

    【讨论】:

      猜你喜欢
      • 2012-11-24
      • 2015-09-30
      • 2011-06-22
      • 2012-04-11
      • 2017-10-26
      • 1970-01-01
      • 1970-01-01
      • 2014-09-03
      • 1970-01-01
      相关资源
      最近更新 更多