Re: Multi-level Models in CakePHP

2010-04-21 Thread WebbedIT
wouldn't one be able to use $this-Model-unbindModel() to take away any unwanted, extra associations? Yes, but that's exactly why Containable was written, it's a convenience wrapper that binds/unbinds all the relevant models based on the info you supply in the contain array of your find call

Re: Multi-level Models in CakePHP

2010-04-21 Thread andy
Ah, that's interesting! Thanks again for the help. Andy On Apr 21, 2:19 am, WebbedIT p...@webbedit.co.uk wrote: wouldn't one be able to use $this-Model-unbindModel() to take away any unwanted, extra associations? Yes, but that's exactly why Containable was written, it's a convenience

Re: Multi-level Models in CakePHP

2010-04-19 Thread WebbedIT
Recursive may do the trick, but you should be getting your head around containable here and if your associations are correct the code Walther provided should have worked. Problem with recursive is if ModelA or ModelB are associated to other models it will go fetch them too as there is no way with

Re: Multi-level Models in CakePHP

2010-04-19 Thread andy
Even with recursion, however, wouldn't one be able to use $this-Model- unbindModel() to take away any unwanted, extra associations? http://book.cakephp.org/view/86/Creating-and-Destroying-Associations-on-the-Fly It's all very likely that I didn't have correct associations earlier... so that

Re: Multi-level Models in CakePHP

2010-04-16 Thread andy
: Multi-level Models in CakePHP Or maybe I'm trying to go for returned data in this type of format... though I don't know if it's possible:  Array  (      [0] = Array          (              [ATable] = Array                  (                      [id] = 1

Re: Multi-level Models in CakePHP

2010-04-16 Thread andy
Using recursive seems to be a way to go about it: $this-set('a', $this-ATable-find('all', array('recursive' = '2'))); I found this via the following post: http://stackoverflow.com/questions/137314/three-table-related-model-in-cakephp Hope that helps someone. Andy Check out the new CakePHP

Multi-level Models in CakePHP

2010-04-15 Thread andy
Has anyone successfully been able to do something like this? (I'm using CakePHP 1.3 RC4) I have three models: class ATable extends AppModel { var $name = 'ATable'; var $hasOne = array('BTable' = array( 'foreignKey' = false, 'type' = 'INNER',

Re: Multi-level Models in CakePHP

2010-04-15 Thread andy
Or maybe I'm trying to go for returned data in this type of format... though I don't know if it's possible: Array ( [0] = Array ( [ATable] = Array ( [id] = 1 [name] = A [weight] = 1

RE: Multi-level Models in CakePHP

2010-04-15 Thread Alan Asher
15, 2010 6:25 PM To: CakePHP Subject: Re: Multi-level Models in CakePHP Or maybe I'm trying to go for returned data in this type of format... though I don't know if it's possible: Array ( [0] = Array ( [ATable] = Array ( [id] = 1

Re: Multi-level Models in CakePHP

2010-04-15 Thread andy
To: CakePHP Subject: Re: Multi-level Models in CakePHP Or maybe I'm trying to go for returned data in this type of format... though I don't know if it's possible:  Array  (      [0] = Array          (              [ATable] = Array                  (                      [id] = 1

Re: Multi-level Models in CakePHP

2010-04-15 Thread Walther
] On Behalf Of andy Sent: Thursday, April 15, 2010 6:25 PM To: CakePHP Subject: Re: Multi-level Models in CakePHP Or maybe I'm trying to go for returned data in this type of format... though I don't know if it's possible:  Array  (      [0] = Array