Hi Bingo, Cheers for the heads up on that - I'll definately give it a shot!
I'm still wondering tho, is it my code that is the problem or a limitation of Cake? I'd like to fully understand why this issue is occuring before moving on to other scripts etc... d. On Nov 23, 8:00 pm, bingo <[EMAIL PROTECTED]> wrote: > hi designvoid, > > I would suggest you that you get that script. In my experience of > using CakePHP, I found it very useful. But I started using that script > before CakePHP 1.2 came into existence and continuing to still use it > in 1.2. You might also want to see if 1.2 has any such functionality. > > Regards > > On Nov 23, 1:49 pm, designvoid <[EMAIL PROTECTED]> wrote: > > > I'm not using that script, I'm relatively new to Cake, making good > > progress but this has stumped me... > > > Is that script needed to do what I want? Or is there a way in vanilla > > Cake? > > > t. > > > On Nov 23, 6:19 pm, bingo <[EMAIL PROTECTED]> wrote: > > > > I guess you need to set (assuming you are using unbindModel > > > scripthttp://bakery.cakephp.org/articles/view/an-improvement-to-unbindmodel...) > > > > $this->Product->Variations->expects('Options); > > > $this->Product->expects('Variations); > > > $this->set('products', $this->Product->findAll()); > > > > bingo > > > > On Nov 23, 12:59 pm, designvoid <[EMAIL PROTECTED]> wrote: > > > > > Hi all, > > > > > I'm having a wierd issue when trying to use 3 models together via 1 > > > > findAll()... I'll paste the code then, explain what's happening, > > > > fingers crossed one I you fine folk will be able to give a me a > > > > pointer as to what I'm missing... > > > > > Basic overview: > > > > > Products has multiple Variations and Variations have multiple Options > > > > > Code: > > > > > class Product extends AppModel { > > > > var $name = 'Product'; > > > > var $primaryKey = 'p_id'; > > > > > var $hasAndBelongsToMany = array('Variations' => > > > > array('className' => > > > > 'Variation', > > > > 'joinTable' => > > > > 'products_variations', > > > > 'foreignKey' => 'p_id', > > > > 'associationForeignKey'=> > > > > 'v_id', > > > > 'conditions' => '', > > > > 'order' => '', > > > > 'limit' => '', > > > > 'unique' => true, > > > > 'finderQuery' => '', > > > > 'deleteQuery' => '', > > > > ) > > > > ); > > > > > } > > > > > -------------------------------------- > > > > > class Variation extends AppModel > > > > { > > > > var $name = 'Variation'; > > > > var $primaryKey = 'v_id'; > > > > > var $hasMany = array('Options' => > > > > array('className' => 'VariationOption', > > > > 'conditions' => '', > > > > 'order' => '', > > > > 'limit' => '', > > > > 'foreignKey' => 'vo_v_id', > > > > 'dependent' => '', > > > > 'exclusive' => '', > > > > 'finderQuery' => '', > > > > 'fields' => '', > > > > 'offset' => '', > > > > 'counterQuery' => '' > > > > ) > > > > ); > > > > > } > > > > > -------------------------------------- > > > > > class VariationOption extends AppModel > > > > { > > > > var $name = 'VariationOption'; > > > > var $primaryKey = 'vo_id'; > > > > > } > > > > > ----------------------------------------------------- > > > > > Now when I run: > > > > > $this->Product->recursive = 3; > > > > $this->set('products', $this->Product->findAll()); > > > > > I only get the following back: > > > > > Array > > > > ( > > > > [0] => Array > > > > ( > > > > [Product] => Array > > > > ( > > > > [p_id] => 1 > > > > [p_name] => A Jumper > > > > [p_description] => Its a lovely wooly jumper for > > > > the winter > > > > [p_image] => jumper.jpg > > > > [p_price] => 10.00 > > > > ) > > > > > [Variations] => Array > > > > ( > > > > [0] => Array > > > > ( > > > > [v_id] => 1 > > > > [v_name] => Sizes > > > > ) > > > > > ) > > > > > ) > > > > > -------------------- > > > > > Now to my reckoning there should be an Options array under > > > > Variations... > > > > > Hope its something simple I've missed and someone can put me straight! > > > > Thanks in advance, > > > > d.- Hide quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---