-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Service not found #9
Comments
ping @jeromegamez |
I already got the notification when you created the issue, no need to ping me one minute after :). This looks as if the Firebase bundle is not configured for your test environment. Please make sure that it either is configured separately, or that the test config imports the config file in which the bundle is configured. |
Oh I'm so sorry - but I'm not in test env my app env is on dev |
Ah, I misinterpreted the environment because of the method name, my bad! Hm... you could try debugging the service container and/or the configuration with the respective Symfony commands. Besides that, I have no clue without seeing the whole project (but don‘t show it to me 😅) Have you seen https://github.com/jeromegamez/firebase-php-examples ? You could compare your project/settings to this and see if you spot some differences. |
Yes I see the example but it's different from the library documents my configuration file is:
|
Based on the configuration you should be able to get If this doesn’t work, please debug your container with |
When I run the command for debugging and search for
|
And if you try |
Still not :( |
The issue come from the controller extend class, if you use the deprecated Controller it's work, but with the latest SF4 we need to extend the AbstractController and with this not working. Reference to fix on latest SF (put it in the repo doc): symfony/symfony-docs#9926 Fix it with:
<?php
namespace App\Controller;
use Kreait\Firebase;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
/**
* Class AppController
* @package App\Controller
*/
class AppController extends AbstractController
{
/**
* @return array
*/
public static function getSubscribedServices(): array
{
return array_merge(parent::getSubscribedServices(), [
'kreait_firebase.default' => Firebase::class,
'firebase' => Firebase::class,
]);
}
} Now if you extend the new AbstractController it's work, remember to change the key related to your services name's. |
As this issue has become stale, I'm closing it now, but please feel free to reopen it. |
Still can't inject Kreait\Firebase. |
The problem
When i calling the service
kreait_firebase
orkreait_firebase.project_name
i get:Environment
kreait/firebase-bundle 1.1.1
kreait/firebase-php 4.16.0
kreait/firebase-tokens 1.7.1
kreait/gcp-metadata 1.0.1
php 7.2.7
symfony 4.1.4
Code to reproduce issue
The text was updated successfully, but these errors were encountered: