On May 4, 10:26 am, Roland B <[email protected]> wrote:
> Hi,
>
> is there a way to change the structure of data returned by a model's
> find call? Or should I use a different call? IMHO, the default seems
> to be inconsistent in the way it handles associations:
>
> Given this model:
> //---------------------------------------
> class Querycategory extends AppModel
> {
>    var $recursive = 10;
>    var $hasMany = array(
>           'Querycategory' => array('order' => 'name ASC'), <--


you can't use the same alias twice - the conventional way to do it -
if you aren't using the tree behavior of course - would be to use
Parent and/or child

var $hasMany = array('Parent' => ('className' => 'Querycategory'

I'd recommend using bake and then looking at what it gives you -
whilst bearing in mind if your db schema is unconventional it's going
to get confused just like you have. There's more general info in the
book around here: 
http://book.cakephp.org/view/78/Associations-Linking-Models-Together

hth,

AD

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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

Reply via email to