src/Command/ParseProductBalanceBlankCommand.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Command;
  3. use App\Util\DocExplUtil;
  4. use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
  5. use Symfony\Component\Console\Input\InputInterface;
  6. use Symfony\Component\Console\Output\OutputInterface;
  7. class ParseProductBalanceBlankCommand extends ContainerAwareCommand
  8. {
  9.     protected static $defaultName 'app:parse-product-balance-blank';
  10.     /**
  11.      * @var DocExplUtil
  12.      */
  13.     protected $docExplUtil;
  14.     /**
  15.      * @param DocExplUtil $docExplUtil
  16.      */
  17.     public function __construct(DocExplUtil $docExplUtil)
  18.     {
  19.         parent::__construct();
  20.         $this->docExplUtil $docExplUtil;
  21.     }
  22.     /**
  23.      * {@inheritdoc}
  24.      */
  25.     protected function configure(): void
  26.     {
  27.         $this->setDescription('Parse product balances from expl.xml');
  28.     }
  29.     /**
  30.      * {@inheritdoc}
  31.      */
  32.     protected function execute(InputInterface $inputOutputInterface $output): void
  33.     {
  34.         $fileName 'expl.xml';
  35.         $fileDir $this->getContainer()->getParameter('kernel.root_dir').'/../var/storage/';
  36.         $filePath $fileDir.$fileName;
  37.         try {
  38.             $this->docExplUtil->processFile($filePath);
  39. //            unlink($filePath);
  40.         } catch (\Throwable $e) {
  41.             $output->writeln('Error: '.$e->getMessage());
  42.         }
  43.     }
  44. }