I am trying to create a blog on Symfony 2 through the http://tutorial.symblog.co.uk/ tutorial.

Part 5 shows how to display the number of comments under each post: <p>Comments: {{ blog.comments|length }}</p> But my Doctrine 2 constantly outputs 0, which is wrong: http://clip2net.com/ s / 6bbulz

Where to look and what could be the reason?

    1 answer 1

    Do before {{blog.comments | length}} output something like {{dump (blog.comments)}} to see if you have any comments at all.

    • This answer should be a comment - Michael Sivolobov