Payum/PayumBundle

Enable Symfony 3.3's autowiring

ThomasLandauer opened this issue · 2 comments

To enable Symfony 3.3's autowiring, a service's must match it's class name, see https://symfony.com/doc/current/service_container/autowiring.html

When I'm injecting Payum into PaymentController like this:

public function prepareAction(Payum $payum)

...I'm getting this error:

Cannot autowire argument $payum of "App\Controller\PaymentController::prepareAction()": it references class "Payum\Core\Payum" but no such service exists. You should maybe alias this class to the existing "payum" service.

The most future-proof solution would be to change https://github.com/Payum/PayumBundle/blob/master/Resources/config/payum.xml to:

<service id="Payum\Core\Payum" class="Payum\Core\Payum">

(or just omit the id attribute - I'm not sure about this)

However, this would make further adjustments inside this file necessary, and I'm not sure if it would be a BC break.

Should I go ahead and give it a try?

We could create an alias to existing payum service. This will do.