-
Notifications
You must be signed in to change notification settings - Fork 80
Description
Hi. I create custom controller for class PromoPageAdmin and set it in the settings in admin.yaml
App\Admin\Action\Content\PromoPageAdmin:
arguments: [ ~, App\Cms\Entity\Content\PromoPage, App\Cms\Controller\Content\PromoPageController ]
calls:
- setTranslationDomain: [ 'promo_page' ]
tags:
- { name: sonata.admin, manager_type: orm, label: promo_page_list }
And in controller
class PromoPageController extends SortableAdminController
{
protected UploadHandler $uploadHandler;
protected SerializerInterface $serializer;
protected LoggerInterface $logger;
protected EntityManagerInterface $entityManager;
public function __construct(
PropertyAccessorInterface $accessor,
PositionHandlerInterface $positionHandler,
UploadHandler $uploadHandler, SerializerInterface $serializer, LoggerInterface $logger, EntityManagerInterface $entityManager
)
{
$this->uploadHandler = $uploadHandler;
$this->serializer = $serializer;
$this->logger = $logger;
$this->entityManager = $entityManager;
parent::__construct($accessor, $positionHandler);
}
}
But I got this error
Cannot autowire service "App\Cms\Controller\Content\PromoPageController": argument "$positionHandler" of method "__construct()" references interface "Runroom\SortableBehaviorBundle\Service\PositionHandlerInterface" but no such service exists. You should maybe alias this interface to one of these existing services: "Runroom\SortableBehaviorBundle\Service\ORMPositionHandler", "Runroom\SortableBehaviorBundle\Service\GedmoPositionHandler".
I tried add in service.yaml:
Runroom\SortableBehaviorBundle\Service\PositionHandlerInterface:
but next error:
Cannot instantiate interface Runroom\SortableBehaviorBundle\Service\PositionHandlerInterface