0

I have an issue with cakephp find method when apply a condition on a related model. Here is my scenario

Machine belongsTo Category
Machine hasAndBelongsToMany Products (products produced by machines)

Now I want all those categories with machines that hasandbelongs to a particular product.

i.e the result set should be like the following array!

Category 1 
   Machine 1 (that can produce for example product1)
   machine 2 (that can produce product 1)
Category 2
  machine 3 (that can produce product 1)
  machine 4 (that can produce product 1)

I have tried the containable behavior and joins but no luck.

Charles
  • 50,943
  • 13
  • 104
  • 142
Farhan
  • 1,561
  • 14
  • 12
  • 1
    let's see some code that you have tried for us to build off of. You should have something like this : `$this->Machine->find('all', array('conditions'=>array('Product.name'=>'Some product name')));` – Tim Joyce Dec 16 '12 at 10:45
  • possible duplicate of [Cakephp, Retreive Data for HABTM Models using conditional find](http://stackoverflow.com/questions/2488524/cakephp-retreive-data-for-habtm-models-using-conditional-find) – dogmatic69 Dec 16 '12 at 14:12

0 Answers0