Мой компонент:
<?php
namespace backend\components\example;
use yii\base\Component;
use yii\helpers\Html;
class example extends Component {
protected $token;
public $options;
public $id;
public $secret;
public $callback;
protected $server = 'http://some.server.ru/';
public function __construct($options, $config) {
parent::__construct($config);
var_dump($options);
}
public function example() {
}
public function init() {
parent::init();
}
public function start() {
echo $this->token;
}
}
?>
файл конфигурации:
<?php
'components' => [
'i18n' => [
'translations' => [
'app*' => [
'class' => 'yii\i18n\PhpMessageSource',
],
],
],
'example' => [
'class' => 'backend\components\example\example',
'options' => [
'id' => 'b1d249b3a53d47e6b7c4e2d334dbe601',
'secret' => '5dc47ecbd5ae4fe9b1692957b2016b6e',
'callback' => 'https://amgexpert.com',
],
],
];
?>
ошибка:
Invalid Configuration – yii\base\InvalidConfigException
Missing required parameter "options" when instantiating "backend\components\example\example"
- Как правильно передать/обработать настройки моего компонента? Пытался перехватить эту переменную options и в функции __construct и в init - везде вываливается ошибка.