3
我有兩個實體一對多關係:Doctrine + Twig,如何在OneToMany關係中顯示Doctrine集合的限制?
一個Article
有Brand
和一個Brand
有很多Articles
。 如何在我的樹枝模板中,我只能顯示每個Brand
的5 Articles
?
什麼是做與光查詢的最佳做法是什麼?
下面,我的代碼:
{% for brand in colBrands %}
{% for article in brand.articles %}
<!-- Display only 5 results and stop -->
{% endfor %}
{% endfor %}
完美的事情,它的作品!非常感謝。 –
速度怎麼樣?如果我有超過10000行?它會獲取所有行並只顯示5? –
是的。在這種情況下,我不會推薦這種方法。 – Mike