Thank you Christoph

I actually can use the TreeBehavior methods on my model but I swear I
thought I could not yesterday (in the 'augmented' model that is).

in the Model :

debug($this->children($id));

So either I was a little well ... off

or my svn update did the trick

in any case it's working as it should now :)

thomas



On May 23, 2:00 pm, Preloader <[EMAIL PROTECTED]> wrote:
> Hello Thomas,
>
> as it is defined, the model "acts as" a tree, which means, you can use
> the tree methods with the model. So the model does not "HAVE" a tree,
> it "IS" a tree.
>
> From the cookbook:
> "Once a behavior has been specified, use the methods added by the
> behavior as if they always existed as part of the original model"
>
> Maybe the cookbook may help you on the whole issue:
>
> http://book.cakephp.org/view/88/behaviors
>
> Regards, Christoph
>
> On 23 Mai, 10:28, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Hello all,
>
> > 2 questions that might have been answered (but I didn't fid the answer
> > - I searched ;)
>
> > In a model that has, say, a TreeBehavior attached to it like so :
>
> > var $actsAs('Tree');
>
> > how would I use the Tree behavior in a model method. What works fo me
> > is :
>
> > $this->Behaviors->Tree->myTreeBehaviorMethod($this, $parameter1, .. )
>
> > but I don't understand why I can't do this :
>
> > $this->Tree->myTreeBehaviorMethod($parameter1, ..)
>
> > I know I can do : $this->Model->myTreeBehaviorMethod
>
> > My second question is about using afterFind and behaviors to 'augment'
> > the data set returned by a query
>
> > in the case of the TreeBehavior it would be adding the previous and
> > next category to the data array
>
> > seems like if I use the behavior in afterFind like
>
> > function afterFind($results) {
>
> >  //assign the results to the model object for convenience
> >  $this->set($results);
>
> >   if($this->id) //if we can access the id => we havex 'read' a record
> >     $results = am($results, $this-<Behaviors->Tree-
>
> > >getparentnode($this, $this->id);
>
> >   return $results;
>
> > }
>
> > I end up in an infinite loop (which kind of makes sense if the
> > behavior executes 'finds')
>
> > How would I go about adding data to my results using the behavior ?
>
> > thomas
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to