title: Doctrine 2.3 Criteria. Accessing a related Object
body: <p>I am trying to set up a Criteria according to <a href="http://docs.doctrine-project.org/en/latest/reference/working-with-associations.html#filtering-collections">the Doctrine Docs</a>.</p>
  
  <p>Unfortunately they don't tell you how to access attributes of an related Object. Let me give you an example.</p>
  
  <p>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:</p>
  
  <pre><code>$criteria = Criteria::create()
    -&gt;where(Criteria::expr()-&gt;eq("category.name", "SomeCategoryName"));
  </code></pre>
  
  <p>Now I get the following Exception:</p>
  
  <pre><code>An exception has been thrown during the rendering of a template ("Unrecognized field: category.name")
  </code></pre>
  
  <p>How can I access a related Object?</p>