Problem with MauticPlugin services.php v5.2

Hi! I’m having a hard time with the services.php in my plugin bundle. If it exists debug:container is not listing my services anymore. If I rename it to _services.php they do. I tried debugging it with die(“test”) command if the services.php is getting called, but right now it seams like it’s not. Thx for the help in advance.

<?php

declare(strict_types=1);

use Mautic\CoreBundle\DependencyInjection\MauticCoreExtension;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return function (ContainerConfigurator $configurator): void {
    $services = $configurator->services()
        ->defaults()
        ->autowire()
        ->autoconfigure()
        ->public();

    $excludes = [
    ];

    $services->load('MauticPlugin\\MyExt\\', '../')
        ->exclude('../{'.implode(',', array_merge(MauticCoreExtension::DEFAULT_EXCLUDES, $excludes)).'}');

    $services->load('MauticPlugin\\MyExt\\Entity\\', '../Entity/*Repository.php')
        ->tag(Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\ServiceRepositoryCompilerPass::REPOSITORY_SERVICE_TAG);

    $services->alias('mautic.myext.model.config', "MauticPlugin\\MyExt\\Model\\EmailConfigModel");
};

Hey, I think you are missing the *Extension.php file. Check the docs: Autowiring — Mautic Developer Documentation 3.0.0 documentation

1 Like

ohh… I missed that one! Thx a lot :slight_smile:

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.