TypeError yii\base\View::{closure}(): Argument #2

yii\base\View::{closure}(): Argument #2 ($model) must be of type Libro, app\models\Libro given

in C:\xampp\htdocs\biblioteca\views\libro\index.php

 'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
 
            'id',
            'titulo',
            'imagen',
            [
                'class' => ActionColumn::className(),
                'urlCreator' => function ($action, Libro $model, $key, $index, $column) {
                    return Url::toRoute([$action, 'id' => $model->id]);
                 }
            ],
        ],
    ]); ?>

I guess you didn’t added path for Libro in view file like use app\models\Libro;

1 Like