0

I'm new in TYPO3 and I'm creating a plugin. when I try to load my view I have this error :

Sorry, the requested view was not found.

The technical reason is: No template was found. View could not be resolved for action "list"
 in class "Vendor\Reservationatelier\Controller\ReservationatelierController".

I have seen similars question in slack, and tried the solutions but without success for me.

I added/activated my template to static templates like the answer of this question :

TYPO3: No template was found. View could not be resolved for action

my template are stored in : Resources/Private/Templates/Reservationatelier/List.html

setup.ts :

plugin.tx_reservationatelier_atelier {
    view {
        templateRootPaths.0 = EXT:reservationatelier/Resources/Private/Templates/
        partialRootPaths.0 = EXT:reservationatelier/Resources/Private/Partials/
        layoutRootPaths.0 = EXT:reservationatelier/Resources/Private/Layouts/
    }
    persistence {
        storagePid = 157
        #recursive = 1
    }

}

I don't see where is my mistake, someone have a solution ?

thanks you

EDIT : Object bowser , controller and structure

object bowser

there is my controller :

<?php


namespace Vendor\Reservationatelier\Controller;


use Vendor\Reservationatelier\Domain\Repository\AtelierRepository;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use Psr\Http\Message\ResponseInterface;

class ReservationatelierController extends ActionController
{
    private $atelierRepository;

    /**
     * Injects the product repository
     *
     * @param AtelierRepository $atelierRepository
     */
    public function injectAtelierRepository(AtelierRepository $atelierRepository)
    {
        $this->atelierRepository = $atelierRepository;
    }

    public function listAction()
    {
        $ateliers = $this->atelierRepository->findAll();
        $this->view->assign('ateliers', $ateliers);
    }

}

structure extension :

structure

Solved : the name used in my setup.ts was wrong

johndoe80
  • 87
  • 10
  • The paths seem to be correct. Are you sure your configuration is included? You can check in the TypoScript object browser (template module) – Mikel Wohlschlegel Apr 09 '22 at 04:56
  • What is your extension key? Is it really the same as the controller name? You can check the name of the extension root dir, straight in typo3conf/ext. It must be equal with EXT:reservationatelier – Mikel Wohlschlegel Apr 09 '22 at 05:03
  • my extension name is "reservationatelier" , I check it to the composer.json of my extension, and for the configuration, I checked the object bowser I edited my question to show you what I have – johndoe80 Apr 09 '22 at 11:53
  • That's strange. Please post your controller. Do you extend the extbase abstract controller? The template exists under typo3conf/ext/reservationatelier/Resources/Private/Templates/Reservationatelier/List.html? – Mikel Wohlschlegel Apr 09 '22 at 17:01
  • I posted my controller, yes I extend abstract to my controller, I posted the structure of my extension too – johndoe80 Apr 09 '22 at 18:23
  • Looks like kicked off by extension builder. Seems all to be good. Maybe a typo somewhere. Delete cache and dump autoloader? – Mikel Wohlschlegel Apr 09 '22 at 21:17
  • I already tried a dump autoload and flush all caches, but without success, its strange – johndoe80 Apr 09 '22 at 22:36
  • What T3 version is it? – Mikel Wohlschlegel Apr 10 '22 at 04:55
  • M’y version is 10.4 – johndoe80 Apr 10 '22 at 10:30
  • Is your plugin defined correctly? Plugin name is "atelier"? Please debug $this->view in your action: debug($this->view) and check, if all template paths are available / accessible. Otherwise: you can provide your ext by github / bitbucket. Than I can have a look into. – Mikel Wohlschlegel Apr 11 '22 at 08:31
  • I checked with the debug and I dont see "baseRenderingContext" , usually this is where we find the paths you know what can be the reason ? – johndoe80 Apr 11 '22 at 09:58
  • So $view is not an instance of TYPO3\CMS\Fluid\View\TemplateView? In this case you have to stack trace also the parent ActionController, as $view is build there. I guess in this case it would be helpful to have a "minimal reproducable example" to check, if the error is in your extension or somewhere else. This is hard to just guessing, as it could just be a configuration error, a missing namespace, missing core files, conflicting modules. Is this installation completely composer based? – Mikel Wohlschlegel Apr 11 '22 at 12:29
  • I solved my issue, It was because the name used in my setup.ts was wrong thanks you for your help ! – johndoe80 Apr 11 '22 at 14:24

1 Answers1

0

You wrote two contradicting paths:

my template are stored in :
Resources/Private/Templates/Reservationatelier/List.html

and

EXT:reservationatelier/Resources/Private/Templates/

So either you move the template a level up (and delete the subfolder) or you adjust the path in the configuration to this

templateRootPaths.0 = EXT:reservationatelier/Resources/Private/Templates/Reservationatelier/
David
  • 5,882
  • 3
  • 33
  • 44
  • I guess that's wrong. His paths seems to be correct. The naming convention is Controller/Action.html – Mikel Wohlschlegel Apr 09 '22 at 04:50
  • yes, I think used the correct naming convention – johndoe80 Apr 09 '22 at 11:54
  • The problem is not about the filename but about the contradicting paths, one is with the subfolder "Reservationatelier", one without. – David Apr 10 '22 at 05:13
  • A plugin can have multiple controller implementations. So the base path ends, where controller/action structure starts. EXT:reservationatelier/Resources/Private/Templates/ can have ControllerName/ActionName.html AND ControllerName2/ActionName.html. See e.g. https://github.com/georgringer/news/blob/a34e236a4ab1d51b73aa3b056b1ccf347058e322/Configuration/TypoScript/setup.typoscript#L8 and the template structure https://github.com/georgringer/news/tree/main/Resources/Private/Templates – Mikel Wohlschlegel Apr 11 '22 at 08:34