ahmed201
(Rifajas)
1
Hi guys, I Cannot generate CRUD for model with composite primary keys.
I have overridden the
getPrimaryKey( $asArray = false )
in my model as
public function getPrimaryKey( $asArray = false )
{
return ['customer_id','group_id'];
}
but Gii throws this error The table associated with app\models\EmailGroupToContact must have primary key(s). always. what is the best way to do this.
ahmed201
(Rifajas)
2
Hello guys, I solved this error by overriding
primaryKey()
instead of
getPrimaryKey()
and this this my snippet
public static function primaryKey()
{
return ['customer_id','group_id'];
}
I hope it might helps someone like me
.
aoimanami
(Kovaccsvera)
3
This is the first post that helped me to understand this and actually worked. Thank you very much!