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
user_category
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:
user
user_category
user_category_Assignments
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));
parent::afterFind();
}
in the user model without any changes to the attributes.
Any Hints?
I am thankful for every help!