File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ abstract class Engine
1212 /** @var ScoutIndex */
1313 public $ scoutIndex ;
1414
15- abstract public function __construct (ScoutIndex $ scoutIndex , SearchClient $ algolia );
15+ abstract public function __construct (ScoutIndex $ scoutIndex , ? int $ siteId = null );
1616
1717 abstract public function update ($ models );
1818
Original file line number Diff line number Diff line change @@ -125,14 +125,26 @@ public function getApplicationId(?int $siteId = null): string
125125 {
126126 $ siteHandle = $ siteId ? Craft::$ app ->getSites ()->getSiteById ($ siteId )->handle : null ;
127127 $ value = ConfigHelper::localizedValue ($ this ->application_id , $ siteHandle );
128- return App::parseEnv ($ value );
128+ $ parsedValue = App::parseEnv ($ value );
129+
130+ if (empty ($ parsedValue )) {
131+ throw new Exception ("Scout application_id is empty for site " . ($ siteHandle ?: 'default ' ) . " (siteId: $ siteId). Check your Scout plugin settings. " );
132+ }
133+
134+ return $ parsedValue ;
129135 }
130136
131137 public function getAdminApiKey (?int $ siteId = null ): string
132138 {
133139 $ siteHandle = $ siteId ? Craft::$ app ->getSites ()->getSiteById ($ siteId )->handle : null ;
134140 $ value = ConfigHelper::localizedValue ($ this ->admin_api_key , $ siteHandle );
135- return App::parseEnv ($ value );
141+ $ parsedValue = App::parseEnv ($ value );
142+
143+ if (empty ($ parsedValue )) {
144+ throw new Exception ("Scout admin_api_key is empty for site " . ($ siteHandle ?: 'default ' ) . " (siteId: $ siteId). Check your Scout plugin settings. " );
145+ }
146+
147+ return $ parsedValue ;
136148 }
137149
138150 public function getSearchApiKey (?int $ siteId = null ): string
You can’t perform that action at this time.
0 commit comments