I have been banging my head on the wall over this. I have a model Sku that belongs to model Purchase. My AppModel has $actAs=array('Containable') and $recursive=-1
Inside SkuController, when I do $this->Sku->find('all', array('contain' => 'Purchase'));
I don't get Purchase. I have searched many old questions here and elsewhere on Internet but just can't seem to resolve this. To check if Containable behavior is being loaded, I edited ContainableBehavior.php in lib\Cake\Model\Behavior to make it an invalid php file but that didn't produce any errors. What the heck is wrong!!
Here's the SQL from debug:
SELECT
Sku
.id
,Sku
.purchase_id
,Sku
.item_id
,Sku
.upc
,Sku
.quantity_avail
,Sku
.per_unit_price_amt
,Sku
.do_not_delete
,Sku
.created
,Sku
.modified
, (concat('SK',lpad(Sku
.id
,8,'0'))) ASSku__idFormatted
FROMsellble
.skus
ASSku
WHERE 1 = 1 ORDER BYSku
.id
desc
CakePHP ver: 2.4.4
actAs
or the properactsAs
variable? Are your variable assignments public, i.e.public $actsAs = array('Containable');
? If you remove the recursive setting, does the purchase data return in your find (just to check the association)? If you create a reflection of your model, does it carry the array containing 'Containable' in the actsAs variable? – Scott Harwell