[SYMFONY 5] Impossible de vider le cache

Par bingana ngono louis, il y a 5 ans


Bonjour,

Je rencontre un petit problème avec mon code.

Ce que je fais

En effet, lorsque j'essaie de vider le cache, une erreur survient, la même chose lorsue j'essaie d'installer un bundle dans mon projet.

C:\Users\USER\Desktop\binganalouis>symfony console cache:clear // Clearing the cache for the dev environment with debug true In FileLoader.php line 173: Unknown property "method" on annotation "Symfony\Component\Routing\Annotation\Route" in C:\Users\USER\Desktop\bingana louis\config/routes\../../src/Controller/ (which is being imported from "C:\Users\USER\Desktop\binganalouis\config/ro utes/annotations.yaml"). Make sure annotations are installed and enabled. In Route.php line 130: Unknown property "method" on annotation "Symfony\Component\Routing\Annotation\Route". cache:clear [--no-warmup] [--no-optional-warmers] exit status 1

Ce que je veux

Je veux que je veux c'est que mon cache se vide, ou que je puisse installer un bundle.

Ce que j'obtiens

A la place, ce que j'obtient c'est une erreur qui me dit Unknown property "method" on annotation "Symfony\Component\Routing\Annotation\Route" in C:\Users\USER\Desktop\bingana louis\config/routes\../../src/Controller/ (which is being imported from "C:\Users\USER\Desktop\binganalouis\config/ro utes/annotations.yaml"). Make sure annotations are installed and enabled.
et une autre à la fin ```In Route.php line 130:

Unknown property "method" on annotation "Symfony\Component\Routing\Annotation\Route".

cache:clear [--no-warmup] [--no-optional-warmers] ```

2 réponses

Cybercraft, il y a 5 ans

Dans ton fichier de routing ou dans tes annotations, il y a une typo : Remplace "method" par "methods" avec un 's'. ;)

Vu l'erreur, ce doit être dans l'annotation d'une méthode d'un de tes controller :

Tu as dû faire un truc du genre :

/** /* @Route("/", method={"GET"}) */

Il faut corriger comme ça :

/** /* @Route("/", methods={"GET"}) */
bingana ngono louis, il y a 5 ans

Merci ça marche, j'ai écris dans un de mes controllers method = {"POST"} Et quand j'ai changé en methods = {"POST"} il n'y a plus d'erreur!