Problem With Yii::$Objectconfig

I use Yii2 app advanced, updated with Composer, and some of my configuration rencently stopped working (last week end, after an update). In my main config file, under common directory, I used this code to configure gridview for all my views:


 \Yii::$objectConfig = [

		'yii\grid\GridView' => [

                 'tableOptions'=>['class'=>'table table-hover table-striped table-condensed']

		 ],

		],	

Now if I use this same code that used to work, I got a blank page everywhere. My question is how can I configure a widget to have the options available for all the views?

Thanks!

Seems like yii\di\Container::set() is used now.

Here’s an example from docs:




$container->set('db', [

    'class' => 'yii\db\Connection',

    'dsn' => 'mysql:host=127.0.0.1;dbname=demo',

    'username' => 'root',

    'password' => '',

    'charset' => 'utf8',

]);

Haven’t tested it by myself though.

Yes, you should DI container now as follows,





Yii::$container->set('yii\grid\GridView', [

	'tableOptions' => [

		'class' => 'table table-hover table-striped table-condensed',

	]

]);



Thank you very much ORey and qiang. The solution you proposed worked rellay fine. The exact syntax is how qiang presented it. You have to put it in your config file within ‘components’.