Using relatedTo programatically?
You're using $criteria, but attempting to set the relatedTo property on $this-&gt;criteria.

Assuming that's not the issue, have you tried using $criteria-&gt;setAttribute('relatedTo', ['targetElement' =&gt; $category])?

I've found setAttribute to be more reliable than the ElementCriteriaModel magic methods.