0
votes

I'm trying to use trackable behavior in CakePHP but with associated models.

I've taken TrackableBehavior as a Model Behavior from Croogo which is based upon a plugin from Jose Gonzalez.

It works like a charm, but I'm trying to find a way to make it work properly when the data of the child/associated model are returned in a view of the "parent" model.

The associations are:

  • Clients hasMany Notes
  • Notes belongTo Clients

To be more clear: Both Models use Trackable Behavior. In the Clients "view" view ( ugh ) I list all the notes that are owned by the Client. I'd like Trackable Behavior to return the trackable records ( created_by / modified_by ) for each note that is listed, yet it only returns the Trackable Array for the parent model ( Clients ).

Any ideas?

1

1 Answers

0
votes

A bit embarrassing. It was as simple as adding this before using the find() method

$this->Model->recursive = 2; 

so CakePHP would go a level deeper to fetch the associated data for each item.