Add a field of another table to ActiveRecord/ActiveDataProvider

hey there,

I’m not sure if this is the correct place because it feels more like a general-discussion but my app is written in yii 1.

I have to restructure our database-schema.
In the past wee had 2 tables
user and
in the user table one field was the foreign-key for the table user_category.

the new requirements are the possibility that a user can have more then one category, so we now have 3 tables:

we load the users in a data-provider and pass it to the grid-view.
I have already written a method in the user model to get the categories witch retrurns an array with the id and the name of the concerning categories, but I have no Idea how to add this categories to the user data-provider.

I also tried:

public function afterFind() {
    array_push($this->attributes, $this->getCategories($this->id));

in the user model without any changes to the attributes.

Any Hints?
I am thankful for every help!

ok, finally I can access the data but it’s still confusing that the data is not in attributes but in top level of the dataprovider.