22
33namespace App \Command ;
44
5- use App \Entity \ImportRun ;
65use App \Entity \System ;
76use App \Service \SystemImporter ;
87use Doctrine \ORM \EntityManagerInterface ;
9- use Symfony \Component \Console \Command \Command ;
108use Symfony \Component \Console \Input \InputInterface ;
119use Symfony \Component \Console \Output \OutputInterface ;
1210use Symfony \Component \Console \Input \InputArgument ;
1311
14- class SystemImportCommand extends Command
12+ class SystemImportCommand extends AbstractImportCommand
1513{
1614 private $ systemImporter ;
17- private $ entityManager ;
1815
1916 public function __construct (SystemImporter $ systemImporter , EntityManagerInterface $ entityManager )
2017 {
21- parent ::__construct ();
18+ parent ::__construct ($ entityManager );
2219
2320 $ this ->systemImporter = $ systemImporter ;
24- $ this ->entityManager = $ entityManager ;
2521 }
2622
2723 protected function configure ()
@@ -45,13 +41,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
4541 $ output ->writeln ($ errorMessage );
4642 }
4743
48- $ importRun = new ImportRun ();
49- $ importRun ->setDatetime (new \DateTime ());
50- $ importRun ->setOutput ($ success ? 'OK ' : $ errorMessage );
51- $ importRun ->setResult ($ success );
52- $ importRun ->setType (System::class);
53-
54- $ this ->entityManager ->persist ($ importRun );
55- $ this ->entityManager ->flush ();
44+ $ this ->recordImportRun (System::class, $ success , $ errorMessage );
5645 }
5746}
0 commit comments