Hazte profesional con las consultas de Doctrine
Relaciones EXTRA_LAZY
  Start your All-Access Pass to unlock this challenge
Buy Access Login

Challenge 1 / 1

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!

Skip challenges and go to theNext Chapter

Turn Challenges Off?

All further challenges will be skipped automatically.
You can re-enable challenges at any time on this page or from your account page.