Overwrite AppBundle/Controller/DefaultController from other Bundle


I’m trying to overwrite the DefaultController from the AppBundle with a Controller from a separate Bundle, so every empty created document uses my new DefaultController.
I already searched the pimcore talk board, the symfony docs and the pimcore docs and wasn’t able to find a working solution.

I created the Bundle Nhc/CoreBundle with the help of “generate bundle interactively”.
Content of my Nhc/CoreBundle/Controller/DefaultController:

namespace Nhc\CoreBundle\Controller;

use Pimcore\Controller\FrontendController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class DefaultController extends FrontendController
    public function defaultAction(Request $request)
        return new Response('Hello world from nhc_core');

Because the DefaultController inside the AppBundle seems to be a public service, i tried to overwrite the service inside my services.yml like this:

# Nhc/CoreBundle/Resources/config/services.yml
        class: Nhc\CoreBundle\Controller\Default

I found this solution in the symfony docs, but it doesn’t work. I always see the default white page with the pimcore logo.

I also tried to set it like this:

        resource: '../../Controller'
        public: true
        tags: ['controller.service_arguments']

But that didn’t worked either…
How can i achieve the overwriting of the AppBundle\DefaultController ?

thx in advanced,

Why do you wanna overwrite the AppBundle\DefaultController with another Controller anyway?

Because its the requirement for a customer of ours that we don’t change anything in the AppBundle and that we overwrite stuff from inside our own Bundle. So everything can be easily reverted if needed.

It would be easier if the setting for the defaultController and defaultAction inside the system settings would still be here, but it seems to be changed in pimcore 6.

Nevermind. Found a solution thx to the help of @scrummer .