当我尝试执行这个DQL查询时:
SELECT r, s FROM Rule r
JOIN r.splash_page s
WHERE r.active = 1我想要做的就是加入两个实体,然后我得到了一个错误:
Notice: Undefined index: rules in C:\xampp\htdocs\excap\vendor\doctrine\orm\lib\Doctrine\ORM\Internal\Hydration\ObjectHydrator.php on line 110
Notice: Undefined index: rules in C:\xampp\htdocs\excap\vendor\doctrine\orm\lib\Doctrine\ORM\Internal\Hydration\ObjectHydrator.php on line 428
Notice: Undefined index: rules in C:\xampp\htdocs\excap\vendor\doctrine\orm\lib\Doctrine\ORM\Internal\Hydration\ObjectHydrator.php on line 428
Notice: Undefined index: rules in C:\xampp\htdocs\excap\vendor\doctrine\orm\lib\Doctrine\ORM\Internal\Hydration\ObjectHydrator.php on line 428
Notice: Undefined index: rules in C:\xampp\htdocs\excap\vendor\doctrine\orm\lib\Doctrine\ORM\Internal\Hydration\ObjectHydrator.php on line 428这些是我的实体文件的一部分,我在其中声明了它们之间的关系:
// Rule.php
/**
*
* @var type
* @ManyToOne(targetEntity="SplashPage", inversedBy="rules")
*/
protected $splash_page;// SplashPage.php
/**
*
* @var type
* OneToMany(targetEntity="Rule", mappedBy="splash_page")
*/
protected $rules = null;知道为什么会这样吗?
发布于 2012-07-07 19:45:42
在您的$rules文档块中有一个错误:您在OneToMany之前忘记了@符号
文档块应该是:
/**
* @OneToMany(targetEntity="Rule", mappedBy="splash_page")
*/
protected $rules = null;而不是
/**
* OneToMany(targetEntity="Rule", mappedBy="splash_page")
*/
protected $rules = null;https://stackoverflow.com/questions/11376444
复制相似问题