2017-10-27 6 views
0

2つのエンティティExportおよびExportItemがあります。エクスポートエンティティのカラムの1つはconfigタイプjsonです(これはデータベースにjsonタイプの列のみです)。輸出主体のPostgreSQL json列のDoctrine orderBy(json型の等価演算子を識別できませんでした)

パート:ExportItemエンティティの

/** 
* @ORM\Column(type="json", nullable=true) 
*/ 
protected $config; 

/** 
* @var ArrayCollection|ExportItem[] 
* @ORM\OneToMany(targetEntity="Entity\ExportItem", mappedBy="export", cascade={"persist", "remove"}, fetch="EXTRA_LAZY") 
*/ 
protected $items; 

パート:

/** 
* @var Export 
* @ORM\ManyToOne(targetEntity="Entity\Export", inversedBy="items") 
*/ 
protected $export; 

私は添付ExportItemsの数あたりの輸出を注文したいのですが、次のクエリは私にエラーを投げる "は識別できませんでしたjson型の等価演算子 "

$this->createQueryBuilder('o') 
    ->join('o.suit', 's') 
    ->where('s.id = :suitId') 
    ->setParameter('suitId', $suit->getId())   
    ->select('COUNT(i) AS HIDDEN nbrItems', 'o.id') 
    ->leftJoin('o.items', 'i') 
    ->orderBy('nbrItems', $orderDir) 
    ->groupBy('o'); 

答えて

0

解決策を見つけました。ただ、クエリで

->groupBy('o.id'); 

を追加する必要があります