R
R
Roman Gor2014-11-21 12:53:02
symfony
Roman Gor, 2014-11-21 12:53:02

Why is Container not being passed to the constructor?

Simfa throws an error:

ContextErrorException: Catchable Fatal Error: Argument 1 passed to Uasector\UserBundle\UserProvider\AbstractSocialNetworkProvider::__construct() must be an instance of Symfony\Component\DependencyInjection\Container, none given, called in /Users/roman/Development/Sites/uasector.dev/app/cache/dev/appDevDebugProjectContainer.php on line 5846 and defined in /Users/roman/Development/Sites/uasector.dev/src/Uasector/UserBundle/UserProvider/AbstractSocialNetworkProvider.php line 33

AbstractSocialNetworkProvider.php line 33:
public function __construct(Container $container, $kernelWebDir, $uploadDir, $defaultAvatarPath)

As I understand it, the Container object is not passed to the constructor. Why can this be?
Here is the service:
services:
    uasector_user.uasector_abstract_user_data_service:
        class: %uasector.user.abstract_social_network_provider.class%
        arguments: ['@service_container', '%kernel.root_dir%', '%uasector_user.image.upload_directory%', '%uasector_user.image.default_avatar_path%']

https://github.com/RomanGorbatko/sy2 - the project itself.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2014-11-21
Protko @Fesor

Forgive my ignorance, but why are you shoving the entire container into the service? This is not good. The only justification for this is cyclical dependencies, which, as it were, is bad, but sometimes it happens.

A
Alex, 2014-11-21
@shoomyst

arguments do not need quotes, both for services and for parameters

B
Boris Benkovsky, 2014-11-21
@benbor

You have something like "abstract class AbstractSocialNetworkProvider". The point is that you shouldn't try to call the constructor of an abstract class. And it's strange that the symphony swears at types ... show
I'm wondering what's in there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question