symfony2 でアプリケーションを開発し、doctrine2 を使用しています。1 つの関数を持つカスタム リポジトリ クラスを作成しました。
<?php
namespace Anotatzailea\AnotatzaileaBundle\Repository;
use Doctrine\ORM\EntityRepository;
/**
* InterpretatzeaRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class InterpretatzeaRepository extends EntityRepository
{
public function getInterpDesberdinak($value)
{
$qb = $this->createQueryBuilder('c')
->select('DISTINCT c.attribute')
->where('c.fer = :Value')
->setParameter('Value', $value);
$Emaitza = $qb->getQuery()->getResult();
return $Emaitza;
}
}
この関数で取得したいのは、個別の c.attribute を持ち、すべて c.fer = 値を持つすべての「Interpretatzea」オブジェクトの配列です。クエリは正しいですか? また、値パラメータをリポジトリ関数に渡す方法も知りたいです。ありがとう