[Symfony 3] Probleme avec un service
Bonjour,
J'ai besoin de faire des fonctions et donc j'ai un service qui contiendra une classe et les differentes methodes que j'ai besoins.
voila mon service qui est dans "src/EPI/MathBundle/Outil/EPIoutil.php"
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
namespace EPI\MathBundle\Outil;
class EPIOutil
{
/**
* Vérifie si le texte est un spam ou non
*
* @param string $text
* @return bool
*/
public function isSpam($text)
{
return strlen($text) < 50;
}
} |
j'ai rajouté dans le fichier "src/EPI/MathBundle/Resources/config/services.yml" ces deux lignes
Code:
1 2 3
|
epi_math.outil:
class: EPI\MathBundle\Outil\EPIOutil |
et quand j'utilise mon service dans un controleur j'ai une erreurs
Code:
1 2 3 4 5 6 7 8 9 10
| public function argAction($value)
{
$outil = $this->container->get('epi_math.outil');
$busy = 0;
$n = 3500;
$p = $value / (8 * 3600);
$k = 0;
$array = array($busy, $n, $p);
return new JsonResponse($array);
} |
voila l'erreur :
http://img4.hostingpics.net/pics/833244synfony.png
Pouvez vous m'aidez ? merci d'avance