'TYPO3 Symfony\Component\DependencyInjection\Exception\RuntimeException

enter image description here

This is the error message I got!

What does it mean, no such service exists?

Here the code of the SpeciesSelectController:

<?php
declare(strict_types=1);

namespace HGA\Hgaplantdb\Controller;

use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use \Psr\Http\Message\ResponseInterface;
use \HGA\Hgaplantdb\Controller;

/**
 * SpeciesSelectController
 */
class SpeciesSelectController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {

    /**
     * SpeciesSelectRepository
     * 
     * @var \HGA\Hgaplantdb\Domain\Repository\SpeciesSelectRepository
     */
    protected $speciesSelectRepository = null;

    /**
     * @param \HGA\Hgaplantdb\Controller\Domain\Repository\SpeciesSelectRepository $speciesSelectRepository
     */
    public function injectSpeciesSelectRepository(\HGA\Hgaplantdb\Domain\Repository\SpeciesSelectRepository $speciesSelectRepository)
    {
        $this->speciesSelectRepository = $speciesSelectRepository;
    }

And here the Services.yaml file:

# Configuration/Services.yaml
services:
  _defaults:
    autowire: true
    autoconfigure: true
    public: false

  HGA\Hgaplantdb\:
    resource: '..\Classes\*'
    exclude: '..\Classes\Domain\Model\*'

  HGA\Hgaplantdb\Controller\SpeciesSelectController:
    public: true

  HGA\Hgaplantdb\Controller\PlantController:
    public: true

Also after asking Google, I have currently no idea, what is wrong!



Solution 1:[1]

Due to another problem with an different extension, I was the meaning, that for windows I had to use \ instead of / in the Service.yaml file. But this was an mistake! After changing it back to

HGA\Hgaplantdb\:
    resource: '../Classes/*'
    exclude: '../Classes/Domain/Mode/*'

it was working fine. Here the complete corrected file:

# Configuration/Services.yaml
services:
  _defaults:
    autowire: true
    autoconfigure: true
    public: false

  HGA\Hgaplantdb\:
    resource: '../Classes/*'
    exclude: '../Classes/Domain/Mode/*'

  HGA\Hgaplantdb\Controller\SpeciesSelectController:
    public: true

  HGA\Hgaplantdb\Controller\PlantController:
    public: true

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Georgio