kreait / firebase-bundle

A Symfony Bundle for the Firebase PHP Admin SDK
https://github.com/kreait/firebase-php
MIT License
135 stars 25 forks source link

The definition for "kreait\firebase\factory" has no class. #26

Closed iamakanksha closed 4 years ago

iamakanksha commented 4 years ago

The problem

Installed the bundle (version 1.2) using composer. Added the bundle to the AppKernel.php and pushed the commit to GitHub. My build is failing due to the following error:

[Symfony\Component\DependencyInjection\Exception\RuntimeException]                                                                                                         
  The definition for "kreait\firebase\factory" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an a  
  bstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error. 

Environment

Details

Tried to set up the bundle with the project, by registering it in AppKernel.php, which is one of the initial steps and it is failing at that point.

Code to reproduce issue

Inside app/AppKernel.php


// ...
class AppKernel extends Kernel
{
    // ...

    public function registerBundles()
    {
        $bundles = array(
            // ...
           new Kreait\Firebase\Symfony\Bundle\FirebaseBundle()
        );
        // ...
    }
}
jeromegamez commented 4 years ago

I believe you need to write new \Kreait instead of new Kreait (prepend a backslash)

iamakanksha commented 4 years ago

I believe you need to write new \Kreait instead of new Kreait (prepend a backslash)

I tried this out but the issue remains

jeromegamez commented 4 years ago

1.2 is a rather old release of the bundle, it might be a bug. Is there a reason why newer 1.x versions of the bundle don't work?

iamakanksha commented 4 years ago

1.2 is a rather old release of the bundle, it might be a bug. Is there a reason why newer 1.x versions of the bundle don't work?

My project uses symfony version 2.8, kreait/firebase-php version 4.18 and firebase-bundle 1.2 seems like the last version compatible with the symfony and firebase-php version used by the project

jeromegamez commented 4 years ago

Have you added code to your application using the SDK, or does the error occur already only by adding the bundle?

Unfortunately I don't have the capacities at the moment to look into it (and Symfony 2.x has been out of support for quite some time now), that's why I currently only can ask question to help guessing what the issue might be.

Given that it's broken for you, it's totally possible that the bundle is generally broken for Symfony 2.x. Perhaps the best solution would be to take the bundle as a kind of blueprint and implement it yourself specifically for your project 🤔

iamakanksha commented 4 years ago

Have you added code to your application using the SDK, or does the error occur already only by adding the bundle?

Unfortunately I don't have the capacities at the moment to look into it (and Symfony 2.x has been out of support for quite some time now), that's why I currently only can ask question to help guessing what the issue might be.

Given that it's broken for you, it's totally possible that the bundle is generally broken for Symfony 2.x. Perhaps the best solution would be to take the bundle as a kind of blueprint and implement it yourself specifically for your project 🤔

The error occurs only on adding the bundle to the project

iamakanksha commented 4 years ago

Tried to update my firebase-php version to a higher version that supports Symfony 2.8 so that I could update the firebase-bundle version. I directly tried to update the firebase-php to version 4.35 to be able to use version the bundle version 1.7, however the installation itself failed. I tried to update the firebase-php version to 4.22 so that I could upgrade to bundle version 1.3, but this issue remains in that version.

iamakanksha commented 4 years ago

@jeromegamez I am unable to create a PR on the older tag of the repository (1.2.0)

jeromegamez commented 4 years ago

I just released 1.2.1 with your changes. Happy coding!