> 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...
You realize that's an incredibly inefficient way to query your data I
hope - and it looks fine to me "..."
> Apart from that, now my root querycategory is 'Querycategory' while all
> other querycategories are 'Node'.
of course they are - the array key is the model alias.
Have a look at the tree behavior or use find('threaded') (after
changing your foreignkey to be parent_id in the db).
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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment