Doctrine会产生一些未定义的错误

时间:2011-12-05 21:06:21

标签: doctrine doctrine-orm

对于某些特殊实体(我无法分辨哪些实体),当我尝试count($Club->getUmbrellas())时,我会收到以下错误,$Club->getUmbrellas()Doctrine\ORM\PersistentCollection

  

注意:未定义的索引:第401行的/var/www/apache/StudCon/library/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php中的id致命错误:调用非成员函数getValue()第401行/var/www/apache/StudCon/library/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php中的对象

  • Club是主要的。
  • ClubClub扩展Club
  • ClubUmbrella扩展Club
  • ClubUmbrellaClubClubRelationClubUmbrella
  • 间接相关

这些是最重要的信息(请询问您是否需要更多信息):

class Club extends \StudCon_Entity
{

    /**
     * @Column(type="string", length="150")
     * @var string
     */
    protected $type;

    /**
     * @Id @GeneratedValue
     * @Column(type="bigint")
     * @var integer
     */
    protected $id;

class ClubClub extends Club
{

    /**
     * @OneToMany(targetEntity="RelationClubUmbrella", mappedBy="club", indexBy="id")
     */
    protected $umbrellas;

class ClubUmbrella extends Club
{

    /**
     * @OneToMany(targetEntity="RelationClubUmbrella", mappedBy="umbrella")
     */
    protected $clubs;

class RelationClubUmbrella
{

    const STATUS_REQUESTED = 1;
    const STATUS_CONFIRMED = 2;
    const STATUS_REJECTED = 3;


    /**
     * @Column(type="integer")
     * @var integer
     */
    protected $status;

    /**
     * @Id
     * @ManyToOne(targetEntity="Club")
     * @JoinColumn(name="umbrellaid", referencedColumnName="id")
     * @var Category
     */
    protected $umbrella;

    /**
     * @Id
     * @ManyToOne(targetEntity="Club")
     * @JoinColumn(name="clubid", referencedColumnName="id")
     * @var Category
     */
    protected $club;

1 个答案:

答案 0 :(得分:0)

看起来你正在使用过时的Doctrine版本。在此期间修复了Similar issues,您应该尝试latest version(已发布today)。