@@ -84,7 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8484 $ themeName = trim ($ input ->getArgument ('theme_name ' ));
8585 $ themeId = $ this ->getThemeId ($ themeName );
8686
87- if (! $ themeId > 0 ) {
87+ if (is_null ( $ themeId) ) {
8888 $ output ->writeln ('<error>Not a valid theme: ' . $ themeName . '</error> ' );
8989 return Command::FAILURE ;
9090 }
@@ -111,8 +111,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
111111 }
112112 }
113113
114- if (! $ scopeId > 0 ) {
115- $ output ->writeln ('<error>Not a valid scopeId: ' . $ scopeId . ' </error> ' );
114+ if (is_null ( $ scopeId) ) {
115+ $ output ->writeln ('<error>Not a valid scope_id </error> ' );
116116 return Command::FAILURE ;
117117 }
118118
@@ -126,24 +126,24 @@ protected function execute(InputInterface $input, OutputInterface $output): int
126126 return Command::SUCCESS ;
127127 }
128128
129- private function getThemeId (string $ themeName ): int
129+ private function getThemeId (string $ themeName ): ? int
130130 {
131131 $ themeModel = $ this ->themeFactory ->create ();
132132 $ this ->themeResourceModel ->load ($ themeModel , $ themeName , 'theme_path ' );
133- return ( int )$ themeModel ->getId ();
133+ return $ themeModel -> getId () ? ( int )$ themeModel ->getId () : null ;
134134 }
135135
136- private function getWebsiteId (string $ scopeId ): int
136+ private function getWebsiteId (string $ scopeId ): ? int
137137 {
138138 $ websiteModel = $ this ->websiteFactory ->create ();
139139 $ this ->websiteResourceModel ->load ($ websiteModel , $ scopeId , 'code ' );
140- return ( int )$ websiteModel ->getId ();
140+ return $ websiteModel -> getId () ? ( int )$ websiteModel ->getId () : null ;
141141 }
142142
143- private function getStoreId (string $ scopeId ): int
143+ private function getStoreId (string $ scopeId ): ? int
144144 {
145145 $ storeModel = $ this ->storeFactory ->create ();
146146 $ this ->storeResourceModel ->load ($ storeModel , $ scopeId , 'code ' );
147- return ( int )$ storeModel ->getId ();
147+ return $ storeModel -> getId () ? ( int )$ storeModel ->getId () : null ;
148148 }
149149}
0 commit comments