I've a problem with creation of a custom sumfony 4 service: I've created a custom class UtilasteurService in sub-folder src/CustumService. But when i run the command php bin/console debug:autowiring
I've the following error.
Expected to find class "App\CustumService\UtilisateurService" in file "C:\wamp\www\semges_api\src/CustumService\UtilisateurService.php" while im porting services from resource "../src/*", but it was not found! Check the namespace prefix used with the resource.
See below my service.yml file and UtilisateurService file.
#service.yml
parameters:
locale: 'en'
services:
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
public: false # Allows optimizing the container by removing unused services; this also means
App\:
resource: '../src/*'
exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'
App\Controller\:
resource: '../src/Controller'
tags: ['controller.service_arguments']
#src/CustumService\UtilisateurService.php
namespace App\CustumService;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
class UtilisateurService
{
private $passwd;
public function __construct($motdepasse)
{
$this->paswd=$motdepasse;
}
public function encodePassword($motdepasse )
{
return $this->passwordEncoder->encodePassword($motdepasse);
}
}
Can somebody help me to understand what is wrong?