I'm trying to get data from TheMovieDB API with Symfony 4 and php-tmdb-api library here. But I have the following error:
Service "tmdb.movie_repository" not found: even though it exists in the app's container, the container inside "App\Controller\BaseController" [...]
My tmdb config:
tmdb_symfony:
api_key: MY_API_KEY
repositories:
enabled: true # Set to false to disable repositories
twig_extension:
enabled: true # Set to false to disable twig extensions
options:
adapter: null
secure: true # Set to false to disable https
host: "api.themoviedb.org/3/"
session_token: null
cache:
enabled: true # Set to false to disable cache
path: "%kernel.cache_dir%/themoviedb"
handler: null
subscriber: null
log:
enabled: false # Set to true to enable log
path: "%kernel.logs_dir%/themoviedb.log"
level: DEBUG
handler: null
subscriber: null
My BaseController :
class BaseController extends AbstractController
{
/**
* @Route("/", name="base")
*/
public function index()
{
$movies = $this->get('tmdb.movie_repository')->getLatest();
dump($movies);
die;
return $this->render('base/index.html.twig', [
'controller_name' => 'BaseController',
]);
}
}