I am trying to set up a Criteria according to the Doctrine Docs.
Unfortunately they don't tell you how to access attributes of an related Object. Let me give you an example.
I have an ArrayCollection of Products. Every Product has a Category. I want to filter the ArrayCollection for a Category Name. Now I am trying to set up a Criteria as follows:
$criteria = Criteria::create()
->where(Criteria::expr()->eq("category.name", "SomeCategoryName"));
Now I get the following Exception:
An exception has been thrown during the rendering of a template ("Unrecognized field: category.name")
How can I access a related Object?
Ctriteria
on monday. Right now I don't have access to my workstation. I will let you know if it works. However filter is a bad idea in my opinion, because all Categories will be eager loaded and then processed locally on the disk (What will never be as perfomant than doing it on a DB). – Sunshine