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 [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