@@ -25,6 +25,7 @@ class DumpCmsData extends \Symfony\Component\Console\Command\Command
2525 private const INPUT_KEY_TYPE = 'type ' ;
2626 private const INPUT_TYPE_VALUES = ['block ' , 'page ' , 'all ' ];
2727 private const INPUT_KEY_IDENTIFIER = 'identifier ' ;
28+ private const INPUT_KEY_REMOVE_ALL = 'removeAll ' ;
2829 private \RocketWeb \CmsImportExport \Model \Service \DumpCmsDataService $ dumpCmsDataService ;
2930
3031 public function __construct (
@@ -51,6 +52,12 @@ protected function configure()
5152 'i ' ,
5253 InputOption::VALUE_OPTIONAL ,
5354 'identifier to process (one or CSV list) '
55+ ),
56+ new InputOption (
57+ self ::INPUT_KEY_REMOVE_ALL ,
58+ 'r ' ,
59+ InputOption::VALUE_NONE ,
60+ 'Flag to remove all existing data '
5461 )
5562 ]);
5663 parent ::configure ();
@@ -59,6 +66,7 @@ protected function configure()
5966 protected function execute (InputInterface $ input , OutputInterface $ output ): void
6067 {
6168 $ type = $ input ->getOption (self ::INPUT_KEY_TYPE );
69+ $ removeAll = (bool )$ input ->getOption (self ::INPUT_KEY_REMOVE_ALL );
6270 if ($ type === null ) {
6371 throw new \RuntimeException ("Type ([-t|--type) is required " );
6472 }
@@ -78,6 +86,6 @@ protected function execute(InputInterface $input, OutputInterface $output): void
7886 $ identifiers = explode (', ' , $ identifiers );
7987 }
8088
81- $ this ->dumpCmsDataService ->execute ($ types , $ identifiers );
89+ $ this ->dumpCmsDataService ->execute ($ types , $ identifiers, $ removeAll );
8290 }
8391}
0 commit comments