File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/DataDefinitionsBundle/Command Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -59,19 +59,23 @@ protected function configure(): void
5959 protected function execute (InputInterface $ input , OutputInterface $ output )
6060 {
6161 $ params = json_decode ($ input ->getOption ('params ' ), true );
62+ $ definitionId = $ input ->getOption ('definition ' );
6263
6364 if (!isset ($ params ['userId ' ])) {
6465 $ params ['userId ' ] = 0 ;
6566 }
6667
6768 try {
68- $ definition = $ this ->repository ->find ($ input ->getOption ('definition ' ));
69- } catch (InvalidArgumentException $ e ) {
70- $ definition = $ this ->repository ->findByName ($ input ->getOption ('definition ' ));
69+ if (filter_var ($ definitionId , \FILTER_VALIDATE_INT )) {
70+ $ definition = $ this ->repository ->find ($ definitionId );
71+ } else {
72+ $ definition = $ this ->repository ->findByName ($ definitionId );
73+ }
74+ } catch (NotFoundException ) {
7175 }
7276
7377 if (!$ definition instanceof ImportDefinitionInterface) {
74- throw new Exception ('Import Definition not found ' );
78+ throw new Exception (sprintf ( 'Import Definition with ID/Name "%s" not found ' , $ definitionId ) );
7579 }
7680
7781 $ this ->importer ->doImportAsync ($ definition , $ params );
You can’t perform that action at this time.
0 commit comments