warrence / yii2-kartikgii

Gii CRUD Generator base on kartik-v extension
BSD 3-Clause "New" or "Revised" License
33 stars 39 forks source link

URLs for Models with composite PKs #3

Open CriStaS opened 10 years ago

CriStaS commented 10 years ago

Hello!

There is a bug...

I have model with composite PK, so I have view?client_id=1&url_id=1 instead of view?id=1

So, GII correctly generates almost all links, but there are links, that made wrong, for example, view.php

'url'=>['delete', 'id' => $model-><?=$generator->getTableSchema()->primaryKey[0]?>],

... generates, for my Model

'url'=>['delete', 'id' => $model->client_id],

instead of

'url'=>['delete', 'client_id' => $model->client_id, 'url_id' => $model->url_id],

and if I'm right it can be fixed by using $generator->generateUrlParams();

I think I made my goal in explaining...

P.S. Thank you for you project, it's currently very useful for me, but I have no time to submit a pull request fixing this issue.

P.S.S. Excuse my poor English, please...

CriStaS commented 10 years ago

Same bug is in controller.php