私はこのクエリに遅れがあります:
$result = $qb->select("p,s,t,w,ph")
->from("Entity\Property", "p")
->innerJoin("p.sub_type","s")
->innerJoin("s.type","t")
->innerJoin("p.web_info","w")
->leftJoin("p.photos","ph")
->where("w.publish_on_trovit > 0")
->andWhere("p.status=0")
->add("orderBy","p.id ASC,ph.display_order ASC")
->setFirstResult($offset)
->setMaxResults($limit)
->getQuery()
->getArrayResult();
問題はエンティティ全体の負荷であり、ラグを解決するには、必要なテーブル フィールドのみを選択する必要があります。
しかし、「p、ph」の代わりに「p.id、ph.id」を使用すると、教義の隠蔽により、結果配列が通常のSQL結合のようなフラットテーブルに変更されます。
上記のクエリの結果のように、parenet->chields 結果セットに必要なフィールドのみをロードする方法はありますか?
ありがとう!