ANNOTATIONS_TO_ATTRIBUTES set removes all annotations rather than only the converted to attributes
AlexeyKosov opened this issue · 2 comments
AlexeyKosov commented
I have an entity:
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
use SimpleThings\EntityAudit\Mapping\Annotation as Audit;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Table(name="products", indexes={
* @ORM\Index(columns={"updated_at"})
* }))
* @ORM\Entity(repositoryClass="App\Repository\ProductRepository")
* @Serializer\ExclusionPolicy("ALL")
* @Audit\Auditable()
*/
class TestEntity
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id()
* @Serializer\SerializedName("id")
* @Serializer\Type("integer")
* @Assert\NotBlank()
*/
protected $id;
}
After running rector with only one set DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES
, it turns into:
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
use SimpleThings\EntityAudit\Mapping\Annotation as Audit;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Table(name: 'products')]
#[ORM\Index(columns: ['updated_at'])]
class TestEntity
{
/**
* @var int
*
* @Serializer\SerializedName("id")
* @Serializer\Type("integer")
* @Assert\NotBlank()
*/
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
protected $id;
}
So these annotations have gone:
* @ORM\Entity(repositoryClass="App\Repository\ProductRepository")
* @Serializer\ExclusionPolicy("ALL")
* @Audit\Auditable()
Whereas on the id
property, the unprocessed annotations are in place.
Is that a bug or feature?
Rector 0.15.10
TomasVotruba commented
Thank you for your report!
We'll need an isolated failing demo link from: http://getrector.org/demo,
that way we can reproduce the bug.
AlexeyKosov commented
Thank you for your report!
We'll need an isolated failing demo link from: http://getrector.org/demo, that way we can reproduce the bug.
Ok, created a new issue: rectorphp/rector#7750