Skip to content

Cache not updated when entity annotation is changed #2644

@alexandresalome

Description

@alexandresalome

This morning, I started a new project with API Platform v2.4, and almost from scratch, I had to clear the cache to get my API documentation updated.

Steps to reproduce

Create a new Symfony application api-platform-issue symfony new --full api-platform-issue.

Go to this new project (cd api-platform-issue).

Install API platform by using composer req api.

Install embedded web server composer req server and start it bin/console server:run.

Open API doc: http://localhost:8000/api

Create an entity Pizza:

<?php

namespace App\Entity;

use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ApiResource
 * @ORM\Entity
 */
class Pizza
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     *
     * @var int
     */
    private $id;

    public function getId(): ?int
    {
        return $this->id;
    }
}

Refresh your API doc, you don't see any change.

Delete your cache (rm -rf var/cache).

API is updated.

Further steps

If you delete the annotation and update cache, you'll see no change.

Environment details

Bug reproduced:

  • With a docker environment (PHP 7.3)
  • With my local PHP setup (PHP 7.2)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions