Summary
Using Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity with a modern Symfony/API Platform stack that relies on PHP attributes causes cache warmup to fail because Doctrine Annotations tries to parse the trait's legacy @ORM\Column docblock.
Environment
- PHP:
8.2.29
gedmo/doctrine-extensions: v3.22.0
stof/doctrine-extensions-bundle: v1.15.3
doctrine/annotations: 2.0.2
doctrine/orm: 3.6.2
doctrine/doctrine-bundle: 2.18.2
symfony/framework-bundle: v6.4.33
symfony/serializer: v6.4.33
api-platform/core: v3.4.17
Minimal setup
Entity:
use Gedmo\Mapping\Annotation as Gedmo;
use Gedmo\SoftDeleteable\SoftDeleteable;
use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
#[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: false)]
class Entity implements SoftDeleteable
{
use SoftDeleteableEntity;
}
Reproduction
- Use API Platform routes/resources so metadata is loaded during cache warmup.
- Run:
php bin/console cache:clear -vvv
Actual result
Cache clear fails with:
[Semantical Error] The class "Doctrine\\ORM\\Mapping\\Column" is not annotated with @Annotation.
... add @IgnoreAnnotation("ORM\\Column") to property ...::$deletedAt
Stack includes:
Doctrine\Common\Annotations\AnnotationReader->getPropertyAnnotations()
Symfony\Component\Serializer\Mapping\Loader\AttributeLoader->getPropertyAnnotations()
- API Platform metadata factories during route loading
Expected result
cache:clear should succeed when using SoftDeleteable with attributes-based mapping.
Observation
In the trait source, property $deletedAt contains both:
- legacy docblock:
@ORM\Column(type="datetime", nullable=true)
- PHP attribute:
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
The docblock annotation appears to be the trigger in this setup.
Question
Would you accept a patch that removes or neutralizes the legacy @ORM\Column docblock in SoftDeleteableEntity (while keeping attribute mapping), to avoid this failure with annotation parsing in modern stacks?
Summary
Using
Gedmo\SoftDeleteable\Traits\SoftDeleteableEntitywith a modern Symfony/API Platform stack that relies on PHP attributes causes cache warmup to fail because Doctrine Annotations tries to parse the trait's legacy@ORM\Columndocblock.Environment
8.2.29gedmo/doctrine-extensions:v3.22.0stof/doctrine-extensions-bundle:v1.15.3doctrine/annotations:2.0.2doctrine/orm:3.6.2doctrine/doctrine-bundle:2.18.2symfony/framework-bundle:v6.4.33symfony/serializer:v6.4.33api-platform/core:v3.4.17Minimal setup
Entity:
Reproduction
Actual result
Cache clear fails with:
Stack includes:
Doctrine\Common\Annotations\AnnotationReader->getPropertyAnnotations()Symfony\Component\Serializer\Mapping\Loader\AttributeLoader->getPropertyAnnotations()Expected result
cache:clearshould succeed when using SoftDeleteable with attributes-based mapping.Observation
In the trait source, property
$deletedAtcontains both:@ORM\Column(type="datetime", nullable=true)#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]The docblock annotation appears to be the trigger in this setup.
Question
Would you accept a patch that removes or neutralizes the legacy
@ORM\Columndocblock inSoftDeleteableEntity(while keeping attribute mapping), to avoid this failure with annotation parsing in modern stacks?