title: Trying to make a filter to retrieve data from related models
body: <p>I have a <code>Post</code> model which <code>hasMany</code> <code>PostField</code><br>
  every post can have several fields stored in the <code>post_fields</code> table..</p>
  
  <p><code>post_fields</code> has this structure: <code>(id, post_id, name, value)</code></p>
  
  <p><code>posts</code> table has some common fields for all posts, but any additional fields should be stored in <code>post_fields</code> table..</p>
  
  <p>I created a search form that is used to filter the posts</p>
  
  <p>when specifying filters for the fields in the <code>posts</code> table, it works fine..<br>
  but I want to make the filter to work even on the other fields found in <code>post_fields</code> ..</p>
  
  <p>I can retrieve the posts first then filter them manually, but i want something more efficient !  </p>
  
  <p><strong>EXAMPLE</strong>: let's suppose that posts are describing some products..</p>
  
  <pre><code>post (id, title, created, price)
  post_fields (id, post_id, name, value)
  </code></pre>
  
  <p>in this case, all posts have <code>title</code>, <code>created</code> and <code>price</code>..<br>
  but if a post (id=3) wants to have a <code>weight</code> field, we should do that by creating a record in <code>post_fields</code>, the record should be :</p>
  
  <pre><code>{ id: .. , post_id: 3, name: weight, value: .. }
  </code></pre>
  
  <p>it's easy now to filter posts according to <code>price</code> (e.g. price between <code>min</code> &amp; <code>max</code>)..<br>
  but, what if i want to filter posts according to <code>weight</code> ??<br>
  e.g. i want all posts that have <code>weight</code> greater than 10 !!</p>
  
  <p>I would like to achieve this preferably in one query, using joins maybe or subqueries ..<br>
  I don't know how to do that in cakePHP, so if any one has an idea, plz HELP !!</p>
  
  <p>even if someone just has an idea but doesn't have details, that could help ...</p>
  
  <p>thanx in advance !</p>