Rui Sousa
Rui Sousa

Reputation: 57

Kartik export menu showing incompatible error message

I'm using kartik export menu and it's showing the error below.

PHP Strict Warning – yii\base\ErrorException

kartik\grid\GridView and kartik\base\BootstrapTrait define the same property ($bsVersion) in the composition of kartik\grid\GridView. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed

Code:

use kartik\grid\GridView;
use kartik\export\ExportMenu;

<?php 
    $gridColumns = [
        ['class' => 'yii\grid\SerialColumn'],
        'id',
        'bi',
        'num_movel',
        'nome_cliente',
        // 'user_criacao',
        'data_criacao',

        ['class' => 'yii\grid\ActionColumn'],
    ];
?>

<div class="export-menu">
    <?php echo ExportMenu::widget([
        'dataProvider' => $dataProvider,
        'columns' => $gridColumns
    ]); ?>
</div>
<div class="c"></div>
<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => $gridColumns,
]); ?>

What can be the cause of this since i've followed the kartik instructions for using the export menu?

Upvotes: 0

Views: 2519

Answers (3)

Frank R Tilugulilwa
Frank R Tilugulilwa

Reputation: 11

This happens when you have a mix of manual install and composer install. Quick fix would be to re-run

sudo composer require kartik-v/yii2-export "dev-master"

yii-2-export can be replaced by a specific widget throwing this error e.g. GridView

Upvotes: 0

Marko Medojević
Marko Medojević

Reputation: 650

I spent a lot of time solving this problem. My issue was version difference between PHP web (7.2) and PHP CLI (5.4). Everything was solved when I executed composer using specified PHP version.

/opt/cpanel/ea-php72/root/usr/bin/php /usr/local/bin/composer update

Upvotes: 0

Javier Rivera
Javier Rivera

Reputation: 26

I had the same issue with kartik-v: yii2-grid 3.1.9 and yii2-export 1.3.0 recent releases. To solve this issue you have two options:

  1. Upgrade to PHP 7.X
  2. Set in composer.json the specific release that is compatible with PHP 5.6.x or 5.7.x.

composer.json

"minimum-stability": "dev",
"prefer-stable": true,
"require": {
    "kartik-v/yii2-krajee-base": "1.9.3",
    "kartik-v/yii2-export": "1.2.9",
    "kartik-v/yii2-grid": "3.1.8",
    "kartik-v/yii2-widget-activeform": "1.5.1",
},

Upvotes: 1

Related Questions