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
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
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
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
: 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
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
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',
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
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
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
] 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
11 matches
Mail list logo