Question

I develop on to different systems. On of them using PHP 5.4 and on the other i have PHP version 5.5.9.

If I open my project with the 5.4 Version all is good and no error is report. But if I try to open the same project with PHP 5.5.9 I got the following error and symfony stop:

ContextErrorException: Runtime Notice: Declaration of Event\UserBundle\Manager\EventManager::getRepository() should be compatible with Event\UserBundle\Manager\AbstractManager::getRepository($entity = NULL) in ...

Now i read that the php strict warning can be produce this error. But in my PHP.ini error settings are this:

E_ALL & ~E_DEPRECATED & ~E_STRICT

Anyone can help me to fix this problem?

Was it helpful?

Solution

The problem is that the method that you are overwriting getRepository is not in the same format as the base method getRepository($entity = null). To stop the error (by making it compatible), just add the $entity = null to the method declaration.

As to the actual errors issue (not showing and then showing) I can't help you. It's possible that things have gotten more strict in the newer version. I did notice recently that a newer version wouldn't allow a function to be declared abstract in a class and then also be declared in an accompanying interface, so it is possible.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top