tags:

views:

63

answers:

1

Hi,

I'm encoutering a problem, but really don't understand why!

I get this error when launching Symfony ( via front controller or CLI )

PHP Fatal error:  Declaration of ECommerceKernel::registerContainerConfiguration() must be compatible with that of Symfony\Framework\Kernel::registerContainerConfiguration()

The problem is the override of the registerContainerConfiguration method.

It's signature is defined in Symfony\Framework\Kernel:

abstract public function registerContainerConfiguration(LoaderInterface $loader);

my overwritten method looks like this:

// in ECommerceKernel
public function registerContainerConfiguration(LoaderInterface $loader)
{
    $return = $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');

    $em = $this->getContainer()->getDoctrine_Orm_EntityManagerService();
    $dm = $this->getContainer()->getDoctrine_Odm_Mongodb_DocumentManagerService();

    $eventManager = $em->getEventManager();
    $eventManager->addEventListener(
        array(\Doctrine\ORM\Events::postLoad), new ECommerceEventSubscriber($dm)
    );

    return $return;
}

My question: Whats the f**k is happening here ? I really can't undertand the error cause method signatures are exactly the same.

this happened after a srv/vendor/symfony upgrade to the latest github's symfony/symfony.

Thanks, Florian.

A: 

Here I have it!

Sorry for the noise, but I just discovered my mistake.

The type hinting made on LoaderInterface $loader must be a

Symfony\Component\DependencyInjection\Loader\LoaderInterface;

and I was using a

Symfony\Components\DependencyInjection\Loader\LoaderInterface

The problem appeared since http://github.com/symfony/symfony/commit/bf82cf42dda099f8c0b6648b7dbd8e8ea7397c1e

Shame on me, cause I was aware of this ( it has been announced int the symfony-devs list ).

the problem is that PHP interpretr doesn't warn you when you try to use an inexisiting class.

Or maybe I missed something ?

Florian