I want to fetch layouts together with the categories, products, ... they are assigned to.
This can be done by adding an association to a query on the pagerepository (this.repositoryFactory.create('cms_page');)
const criteria = new Criteria(this.page, this.limit);
criteria.addAssociation('categories');
in the listCriteria method.
There might be many matches, so I want to get only the first 5 associated entities.
I tried
criteria.addAssociation('categories').setLimit(5);
But that would limit the full query.
How can I fine-tune this associated query?
Just figured it out after posting:
This works after adding the association:
EDIT: Even this single line is enough: The association does not need to be added first.
getAssociation()does this implicitly.