symfony-cli-skeleton
symfony-cli-skeleton copied to clipboard
Unable to use dependency injection
Hi I am attempting to use dependency inject with the services.yml file but it doesnt seem to work. here is what I have. Am i missing something?
services.yml
services:
filesystem:
class: Symfony\Component\Filesystem\Filesystem
version:
class: Skel\Lib\Version
logstash_service:
class: Dasher\Service\LogstashService
project_events:
class: Dasher\Console\Command\Gitlab\ProjectEventsCommand
arguments: ["logstash_service"]
tags:
- { name: console.command }
and the class I am attempting to use it in:
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Dasher\Service\LogstashService;
use \GuzzleHttp\Client;
class ProjectEventsCommand extends Command{
protected $secure_config;
protected $client;
protected $logstash;
public function __construct(LogstashService $logstash){
$this->client="";
$this->secure_config="";
$this->logstash = $logstash;
parent::__construct();
}
I am getting this error:
Argument 1 passed to Dasher\Console\Command\Gitlab\ProjectEventsCommand::__construct() must be an instance of Dasher\Service\LogstashService