Why is this Symfony annotation not working?

Why is this Symfony annotation not working?

Before I start, I should mention that this is&nbsp;<strong>Symfony 2.8.25</strong>. (I just started working on this code base, and once we get some critical issues resolved, we'll be upgrading.)

Before I start, I should mention that this is Symfony 2.8.25. (I just started working on this code base, and once we get some critical issues resolved, we'll be upgrading.)

I have an existing class using annotations with a number of routes that work fine.

I added a new one, and I get a 404 on that one every time. I did a console cache:clear which did not help. When I did a console debug:route, the new Routes appear in the list. But I still get a 404 on them, while the others in the same source file work.

All the routes use a POST, the working and non-working ones.

The routing.yml looks like this:

app:
    resource: '@AppBundle/Controller/'
    type: annotation

logout: path: /logout

The class looks like this:

<?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use AppBundle\Entity\Environment; use AppBundle\Entity\Instance; use AppBundle\Entity\Migration; use AppBundle\Entity\UserActivity; use AppBundle\Entity\Task; use AppBundle\Form\Environment\EnvironmentType; use AppBundle\Services\Api; use AppBundle\Utils\HashRequest;

class EnvironmentController extends Controller { ... /** * * @Route("/api/envtype/add", name="api_envtype_add") * */ public function addEnvtypeAction(Request $request){ ...

When I try another route from this same class, it works. But not this new one.

I tried renaming the route, and that made no difference. I checked the annotation comment for TABs, since that's a (semi-)known bug in older versions. No TABs in the annotation.

This annotation looks to me exactly like the others that work. (None of them have a @return, for example.)

PostMan reports No route found for "POST /api/envtype/add"

I am completely out of ideas.

symfony

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

GraphQL between Angular and Symfony

GraphQL between Angular and Symfony: What is GraphQL? Add GraphQL to Symfony. Add GraphQL to Angular and how to request data. GraphQL is a query language for APIs.

What is Symfony? Features and applications

**Symfony is a PHP framework** whose work in building and maintaining web applications works very quickly and turns into recurring coding tasks. There are some prerequisites to start it in your computer-Such as - Linux, FreeBSD, Mac OS or...

Symfony Vs Laravel Framework – What to Select

Wondering if you want to choose Symfony or Laravel for your project? Let's have a look at some key points of Symfony Vs Laravel comparison to help you choose a framework for your upcoming project.

Symfony 3 application running on OSX

My Symfony 3.4 application is running super slow on DEV environment - it is taking about 35 seconds when using Docker and 20 seconds when running with Symfony's server.