I am learning Yii2. Here is one situation I have not googled the answer.
I register a component called scraper
in config/console.php
's $config['components']
array,
this scraper
class has a public property $_client
which is a Goutte\Client
class.
I tried to use the following way to set up scraper
component, but it is not working, Yii2 did not instantiate $_client
as a Goutte\Client
object.
$config = [
'scraper' => [
'class' => 'app\models\Scraper',
'_pageSize' => 10,
'_client' => [ //not working. can not instantiate this property as an object
'class' => 'Goutte\Client'
],
],
//...
]
Question: What would be working way to inject the dependency in the configuration?