Cakephp Containable not working at all -
i have been banging head on wall on this. have model sku belongs model purchase. appmodel has $actas=array('containable') , $recursive=-1
inside skucontroller, when $this->sku->find('all', array('contain' => 'purchase'));
don't purchase. have searched many old questions here , elsewhere on internet can't seem resolve this. check if containable behavior being loaded, edited containablebehavior.php in lib\cake\model\behavior make invalid php file didn't produce errors. heck wrong!!
here's sql 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')))sku__idformatted
sellble
.skus
sku
1 = 1 ordersku
.id
desc
cakephp ver: 2.4.4
not sure if different across versions have specified contain within array , works fine me.
$this->sku->find('all', array('contain' => array('purchase')));
or mapping fields or conditions want:
$this->sku->find('all', array('contain' => array( 'purchase' => array( 'fields' => purchase.name 'conditions' => array( purchase.name = 'somename' ) ) ) ) );
Comments
Post a Comment