Open tacman opened 5 years ago
it's maybe to late but i have resolve the problem with :
# config/services.yml
services:
# ...
FS\SolrBundle\SolrInterface: '@solr.client'
# src/Controller/MyController.php
use FS\SolrBundle\SolrInterface;
class SiteController extends AbstractController{
#...
public function recherche(SolrInterface $client){
//my code
}
#...
}
Symfony4 makes services private by default, so the examples that show getting the client from the container no longer work without additional configuration (making the service public), or injecting the container, which is discouraged (but works).
What is the name of the class to be used when getting the client via Dependency Injection? I was hoping to simply inject \Solarium\Client, but am getting an error:
Can you provide an example with a Symfony4 service or controller that doesn't inject the container? Thanks!