Symfony 5.x - What is the point of the alias logic?

63 Views Asked by At

I'm working on the migration of a project from Symfony 3.x to 5.4. It's based on a CMS (Ibexa) and came across the deprecation :

 Cannot autowire service "MyClient\Bundle\Manager\MyManager": argument "$fieldHelper" of method "__construct()" references class "eZ\Publish\Core\Helper\FieldHelper" but no such service exists. You should maybe alias this class to the existing "ezpublish.fi
  eld_helper" service.

I solved it by declaring in my services.yaml :

bind:
    eZ\Publish\Core\Helper\FieldHelper: ezpublish.field_helper

I'm confused as to the point of this change at the framework level. Why do I need to add an alias for an already registered service - that came in the package I'm using ? I fail to see the benefits. Is there a better solution to use it out of the box ?

0

There are 0 best solutions below