pix-digital / pixSortableBehaviorBundle

Offers a sortable feature for your Symfony2 admin listing
MIT License
46 stars 77 forks source link

Service "pix_sortable_behavior.position.orm" not found #92

Open nilov opened 3 years ago

nilov commented 3 years ago

Service "pix_sortable_behavior.position.orm" not found: even though it exists in the app's container, the container inside "Pix\SortableBehaviorBundle\Controller\SortableAdminController" is a smaller service locator that only knows about the "doctrine", "form.factory", "http_kernel", "logger", "parameter_bag", "request_stack", "router", "security.authorization_checker", "security.csrf.token_manager", "security.token_storage", "serializer", "session", "sonata.admin.audit.manager", "sonata.admin.object.manipulator.acl.admin", "sonata.admin.pool", "sonata.admin.request.fetcher", "translator" and "twig" services. Try using dependency injection instead.

TheFox commented 2 years ago

@nilov Did you find a solution for this problem?

er1z commented 2 years ago

The easiest way is to copy the controller to app scope and replace all dependencies with recent ones.

And then:

App\Controller\Admin\SortableAdminController:
   arguments:
      $positionHandler: '@pix_sortable_behavior.position'
   tags:
      - controller.service_subscriber
dmitryuk commented 2 years ago

Sonata admin officially migrated to runroom-packages/sortable-behavior-bundle, try it instead. https://symfony.com/bundles/SonataAdminBundle/current/cookbook/recipe_sortable_listing.html