I generated a model from my Category table, why does it says getCategory0. My Category table doesn’t have 0 on it. Sorry I just don’t get it.
public function getCategory0() { return $this->hasOne(Category::className(), ['id' => 'category_id']); }
Framework created getCategory0() because getCategory() already exist. It’s just a name. You can rename this method as you wish
its likely you have a foreign key index on your category_id, yii is being helpful but this does not mean you have to use the code that is generated by gii it is there to get you going make changes as you see suitable for your app.
I see, thank you.