Flag of Ukraine
SymfonyCasts stands united with the people of Ukraine
Next Chapter

Challenge #1 of 1


Q: 

Check out this sweet Category entity:

class Category
{
    // ..

    #[OneToMany(targetEntity: Product::class, fetch: 'EXTRA_LAZY')
    private Collection $products;
}

Imagine you query for a Category (with no joins) and pass it into this template:

<h1>{{ category.name }}</h1>

Product Count: {{ category.products|length }}

<ul>
    {% for product in category.products %}
        <li>{{ product.name }}</li>
    {% endfor %}
</ul>

How many total queries will this page make?

Hint: Don't forget to count the 1 initial query for the Category entity!

userVoice