title: Symfony 5 console command - problem with constructor with parameter
body: <p>I have a problem with <strong>console's command</strong> in Symfony 5. <br /><br />I try to pass one parameter in constructor's command (<strong>TerytWMRODZRepository $terytwmrodzrepo</strong>), because I want to connect with database and exec queries. One way to do this is create repository to entity, and I done this. But when <strong>I put parameter in constructor's command</strong>, I have error. <br /><br />Below code this console's command:</p>
  
  <pre><code># src/Command/GetNewDataTerytCommand.php
  # ...
  &lt;?php
  
  namespace App\Command;
  
  use Symfony\Component\Console\Command\Command;
  use Symfony\Component\Console\Input\InputInterface;
  use Symfony\Component\Console\Output\OutputInterface;
  use Symfony\Component\Httpfoundation\Response;
  use App\TERYT_SoapClient;
  use App\Service\DB\TerytDB;
  use Doctrine\ORM\EntityManagerInterface;
  use Symfony\Component\Console\Command\LockableTrait;
  use App\Repository\TerytWMRODZRepository;
  
  class GetNewDataTerytCommand extends Command
  {
      protected static $wsdl = 'https://uslugaterytws1test.stat.gov.pl/wsdl/terytws1.wsdl';
  
      private $terytwmrodzrepo;
  
      protected static $defaultName = 'teryt:get';
  
      public function __construct(TerytWMRODZRepository $terytwmrodzrepo){
  
          $this-&gt;terytwmrodzrepo= $terytwmrodzrepo;
  
          parent::__construct();
      }
      ...
  }
  </code></pre>
  
  <p>When I use console's command in terminal: <strong>'php bin/console teryt:get'</strong>, I have output like:</p>
  
  <p><br />ArgumentCountError {#67</p>
  
  <pre><code>  #message: "Too few arguments to function App\Command\GetNewDataTerytCommand::__construct(), 0 passed in /var/www/html/umowy_uzytkownicy/bin/console on line 43 and exactly 1 expected"&lt;br /&gt;
    #code: 0&lt;br /&gt;
    #file: "./src/Command/GetNewDataTerytCommand.php"&lt;br /&gt;
    #line: 27&lt;br /&gt;
    trace: {&lt;br /&gt;
      ./src/Command/GetNewDataTerytCommand.php:27 {&lt;br /&gt;
        App\Command\GetNewDataTerytCommand-&gt;__construct(TerytWMRODZRepository $terytwmrodzrepo)&lt;br /&gt;
        › &lt;br /&gt;
        › public function __construct(TerytWMRODZRepository $terytwmrodzrepo){&lt;br /&gt;
        › &lt;br /&gt;
      }&lt;br /&gt;
      ./bin/console:43 { …}&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;&lt;br /&gt;
  </code></pre>
  
  <p>I tried find solution in <strong>documentation's Symfony 5</strong> on url:<a href="https://symfony.com/doc/current/console/commands_as_services.html" rel="nofollow noreferrer">https://symfony.com/doc/current/console/commands_as_services.html</a> and other pages like: <a href="https://ourcodeworld.com/articles/read/1131/how-to-access-the-entity-manager-doctrine-inside-a-command-in-symfony-5" rel="nofollow noreferrer">https://ourcodeworld.com/articles/read/1131/how-to-access-the-entity-manager-doctrine-inside-a-command-in-symfony-5</a>
  but nothing working.
  <br /><br />
  I tried in <strong>config/service.yaml</strong> configure console's commands as service but nothing changed:</p>
  
  <pre><code># config/services.yaml
  # ...
  services:
      ...
      App\Command\GetNewDataTerytCommand:
          public: true
          tags:
             - { name: 'console.command', command: 'teryt:get'}
  
  </code></pre>
  
  <p>PS: I apologize for my English. This is my first question in StackOverFlow.</p>
  
  <p>Thank you very much</p>