# Plugin Development Controller "The controller for URI "/s/myplugin" is not callable

**URL:** https://forum.mautic.org/t/plugin-development-controller-the-controller-for-uri-s-myplugin-is-not-callable/30959
**Category:** Development
**Tags:** development
**Created:** [February 19, 2024, 9:26pm UTC](https://forum.mautic.org/t/plugin-development-controller-the-controller-for-uri-s-myplugin-is-not-callable/30959 "2024-02-19T21:26:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mcdiver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mcdiver/32/6618_2.png) [@mcdiver](https://forum.mautic.org/u/mcdiver)
#### Post date: [February 19, 2024, 9:26pm UTC](https://forum.mautic.org/t/plugin-development-controller-the-controller-for-uri-s-myplugin-is-not-callable/30959/1 "2024-02-19T21:26:39Z")

</div>

Hello Mautic Community,

I just started learning how to make Mautic Plugin. I have not come far yet, but I am not giving up.

I created the following config file, which successfully adds a button to my Mautic (5.0.2) Menu on the left side

```auto
<?php

return [
    'name' => 'MyPluginBundle',
    'description' => 'Do Something with Mautic',
    'author' => 'McDiver', // Change this to plugin author
    'version' => '0.0.1', // Change this version to your appropriate version'services' => [
    'services' => [
        'helpers' => [
            'plugin.myplugin.model.myplugin' => [
                'class' => \MauticPlugin\MyPluginBundle\Model\MyPluginModel::class,
                'arguments' => []
            ]
        ]
    ],
    'menu' => [
        'main' => [
            'items' => [
                'plugin.myplugin.menu.index' => [
                    'iconClass' => 'fa-line-chart',
                    'children' => [
                        'plugin.myplugin.menu.upload' => [
                            'route' => 'myplugin_default',
                        ],
                    ],
                'priority' => -999,
                ],
            ],
        ],
    ],

    'routes' => [
        'main' => [
            'myplugin_default' => [
                'path' => '/myplugin',
                'controller' => 'MyPluginBundle:MyPlugin:default',
            ],
        ],
    ],
];

```

Next I want to call MyController if I press the submenu in the left bar (plugin.myplugin.menu.upload) Unfortunately, this is where I struggle. Mautic logs that the Controller is not callable. Do I get it right, that Mautic cannot find the controller itself, which I defined in routes path? Do I have to pass the path somewhere special?

The controller is in the Controller subdirectory and looks like this

```auto
<?php
/*
 * @copyright 2014 Mautic Contributors. All rights reserved
 * @author Mautic
 *
 * @link http://mautic.org
 *
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */

namespace MauticPlugin\MyPluginBundle\Controller;

use Mautic\CoreBundle\Controller\FormController;

class MyPluginController extends FormController
{

    public function defaultAction()
    {
        $arn = "HelloWorld";
		// Here will follow some code...
    }
}

```

The target is that if I press the new menu in the left bar, I can see a mask for inserting some data, which shall later be pushed to some contacts. This is just an idea for learning.  
I read all HelloWorld examples, took a look in other Bundles and asked ChatGpt, but unforutnately unsuccessfull.

Please let me know, if you need further information  
I am happy to read from you! 🙂

---

<div class="post-metadata">

### Author: ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)
#### Post date: [February 20, 2024, 10:27am UTC](https://forum.mautic.org/t/plugin-development-controller-the-controller-for-uri-s-myplugin-is-not-callable/30959/2 "2024-02-20T10:27:46Z")

</div>

Check how the things are done in core, specifically the following two files:

> <https://github.com/mautic/mautic/blob/fe4e4547de7ca99259057a7422ab878a50975f6d/app/bundles/LeadBundle/Controller/LeadController.php>

> <https://github.com/mautic/mautic/blob/fe4e4547de7ca99259057a7422ab878a50975f6d/app/bundles/LeadBundle/Config/config.php#L45>

---

<div class="post-metadata">

### Author: ![mcdiver](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mcdiver/32/6618_2.png) [@mcdiver](https://forum.mautic.org/u/mcdiver)
#### Post date: [February 20, 2024, 9:20pm UTC](https://forum.mautic.org/t/plugin-development-controller-the-controller-for-uri-s-myplugin-is-not-callable/30959/3 "2024-02-20T21:20:45Z")

</div>

Thank you for the answer. I had to put the enitre path to the config

```auto
'routes' => [
        'main' => [
            'myplugin_upload_index' => [
                'path' => '/myplugin/{page}',
                'controller' => '\MauticPlugin\MyPlugin\Controller\MyPluginController::indexAction',
            ],
        ],
    ],

```

Now I get the error message, that some namespace is wrong. But I will figure this out tomorrow

```auto
There are no registered paths for namespace "MyPluginBundle"." at [...]/vendor/twig/twig/src/Loader/FilesystemLoader.php 

```

This refers to the response of indexAction in the controller, where I currently return this

```auto
return $this->delegateView(
            [
                'viewParameters' => [
                    'para_test' => 'test124',
                ],
                'contentTemplate' => '@MyPluginBundle/Integration/myfirst.html.twig',
                'passthroughVars' => [
                    'activeLink' => '#myplugin_upload_index',
                    'mauticContent' => 'myplugin',
                    'route' => $this->generateUrl('myplugin_upload_index'),
                ],
            ]
        );

```

A small step today, but better than nothing…
