hello,
When Gii creates the CRUD files for a model, it typically creates an ActionColumn in the Gridview widget. Something like:
[
'class' => ActionColumn::className(),
'urlCreator' => function ($action, Colour $model, $key, $index, $column) {
return Url::toRoute([$action, '_id' => $model->_id]);
}
],
In this model, the table definition is:
CREATE TABLE public._colour (
_id smallint NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 201),
_name public.citext NOT NULL,
CONSTRAINT _colour_pk PRIMARY KEY (_id),
CONSTRAINT _colour_name_uk UNIQUE (_name)
);
The above ActionColumn definition (correctly) creates/derives URLs like: /colour/view?_id=201
.
In The Yii Book (p272/273), the author configures the ActionColumn using
'template' => '{update} {view}',
When I use this code, the URLs are like: /colour/view?id=201
. The _
character is removed from the parameter name and I get Missing required parameters: _id
.
I can’t work out why.Can anyone explain what’s happening?
TIA.