How to decorate final class Sonata\PageBundle\Admin\BlockAdmin

Viewed 25

Since Sonata\PageBundle\Admin\BlockAdmin is @final i should not extend from it. In UPGRADE-3x.md i can see that i should use decoration.

I am trying to this by decorating this final class with App\Sonata\PageBundle\Admin\PageAdmin.

services.yaml configuration:

parameters:
    sonata.page.admin.page.class: App\Sonata\PageBundle\Admin\PageAdmin

services:
    Sonata\PageBundle\Admin\PageAdmin:
        alias: sonata.page.admin.page

    App\Sonata\PageBundle\Admin\PageAdmin:
        decorates: Sonata\PageBundle\Admin\PageAdmin

Decorator App\Sonata\PageBundle\Admin\PageAdmin body looks like this (i just invoke all the methods from final class in my decorator): https://gist.github.com/AVAW/910604534684eedb228f71df1d7deb40

But i get error: enter image description here

Is there any possible way to decorate this final service or I am doing something wrong?

I am using:

sonata-project/admin-bundle: 3.107.3
sonata-project/page-bundle: 3.26.0
symfony: 4.4.41
0 Answers
Related