Replies: 2 comments
-
I tried creating a new provider and it was successfully detected but this only work if the location is inside app/ folder not work with sub folder like we create a special folder, let say I imagine if we could create like app/Provider/
and load it automatically. |
Beta Was this translation helpful? Give feedback.
0 replies
-
i modified that function like this: in app/Config/App.php public array $providers = ['Provider/SearchProvider1', 'Provider/SearchProvider2',]; /**
* Finds the search provider classes.
*/
private function locateProviders(): array
{
$searchProviders = setting('App.providers');
$locator = service('locator');
if (empty($searchProviders)) {
return [];
}
$providers = [];
foreach ($searchProviders as $file) {
$searchFile = $locator->search($file);
$result = array_shift($searchFile);
$class = $locator->findQualifiedNameFromPath($result);
if (empty($class)) {
continue;
}
$providers[] = new $class();
}
return $providers;
} it works fine as I wanted, but if there is another way without modify the SearchEngine class please let me know. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone,
I see here the
$providers
variable uses an array type which means it is possible to use more than one provider.Let say we have
SearchProvider
for Users and for Threads. but how to implement it for 2 different providers?This code seems to only get 1 provider file, because there cannot be 2 files with the same name in the same folder. CMIIW
Bonfire2/src/Search/SearchEngine.php
Lines 51 to 72 in b892532
Beta Was this translation helpful? Give feedback.
All reactions