0

このDQLクエリを実行しようとすると:

SELECT r, s FROM Rule r
JOIN r.splash_page s
WHERE r.active = 1

私がやろうとしているのは、2つのエンティティに参加するだけで、次のエラーが発生します。

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;

なぜこれが起こっているのか考えてみてください。

4

1 に答える 1

6

ドックブロックにタイプミスがあります$rules。OneToManyの@前にサインを忘れています。

docblockは次のようになります。

/**
 * @OneToMany(targetEntity="Rule", mappedBy="splash_page") 
 */
protected $rules = null;

それ以外の

/**
 * OneToMany(targetEntity="Rule", mappedBy="splash_page") 
 */
protected $rules = null;
于 2012-07-07T19:45:42.877 に答える