[Resolved]Crud Genaration With Composite Primary Key

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.

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 :D .

This is the first post that helped me to understand this and actually worked. Thank you very much!:)