Hi,

ok, tried that, but the inconsistency in the data structure stays:

Model:
======
class Querycategory extends AppModel
{
   var $recursive = '10';
   var $hasMany = array(
          'Node' => array('className' => 'Querycategory'),
          'Leaf'    => array('className' => 'Querygroup'));
}

Result:
=======
Array
(
    [0] => Array
        (
            [Querycategory] => Array
                (
                    [id] => 70
                    [querycategory_id] => 34
                )

            [Node] => Array
                (
                    [0] => Array
                        (
                            [id] => 71
                            [querycategory_id] => 70
                            [Leaf] => Array
                                (
                                    [0] => Array
                                        (
                                            [id] => 43
                                            [querycategory_id] => 71
                                        )
                                )

                            [Node] => Array
                                (
                                    [0] => Array
                                        (
                                            [id] => 30
                                            [querycategory_id] => 35
                                            [name] => Bau
                                            [Leaf] => Array
                                                (
                                                )
                                        )
                                )
                        )
                )

            [Leaf] => Array
                (
                )
        )
)

As you can see, Leaf is sometimes on the same level as its parent,
sometimes it is included. Same happens with Node.

This is an inconsistent structure...

Apart from that, now my root querycategory is 'Querycategory' while all
other querycategories are 'Node'.


Thanks and regards,

Roland

AD7six wrote:
> 
> On May 5, 10:05 am, AD7six <[email protected]> wrote:
>> 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'
> 
> oops
> var $belongsTo = array('Parent' => ('className' =>
> 'Querycategory', ...
> var $hasMany = array('Child' => ('className' => 'Querycategory', ...
> 
> 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

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