DDC-3230: Bug in clear cache #4001

Open
opened 2026-01-22 14:33:30 +01:00 by admin · 1 comment
Owner

Originally created by @doctrinebot on GitHub (Jul 25, 2014).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user flip101:

  1. Redis is used for cache/meta/result caching.
  2. Entity has property $deleted with gedmo deletable on it.
  3. Removing property $deleted (and all related annotations)
  4. Symfony commands:
    php app/console doctrine:cache:clear-metadata php app/console doctrine:cache:clear-query php app/console doctrine:cache:clear-result php app/console cache:clear --env=prod --no-debug <-- error on this command
  5. [ReflectionException]
    Property Entity::$deleted does not exist

Trace:

#1 \vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php(571)
#2 \vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php(210) <-- CacheRedis driver called here
#3 \vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php(114)
#4 \vendor\symfony\symfony\src\Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer.php(69)
#5 \vendor\symfony\symfony\src\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate.php(48)
#6 \app\bootstrap.php.cache(2513)
#7 \app\bootstrap.php.cache(2284)
#8 \vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php(128)
#9 \vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php(90)
#10 \vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php(252)
#11 \vendor\symfony\symfony\src\Symfony\Component\Console\Application.php(894)
#12 \vendor\symfony\symfony\src\Symfony\Component\Console\Application.php(193)
#13 \vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php(96)
#14 \vendor\symfony\symfony\src\Symfony\Component\Console\Application.php(124)
#15 \app\console(27)```

Why do i think this is a Doctrine bug and not a Symfony bug? Because
`php app/console doctrine:cache:clear-metadata
php app/console doctrine:cache:clear-query
php app/console doctrine:cache:clear-result`
have been called successfully so RedisCache should not return cache with $this->fieldMappings containing key "deleted"
Originally created by @doctrinebot on GitHub (Jul 25, 2014). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user flip101: 1. Redis is used for cache/meta/result caching. 2. Entity has property $deleted with gedmo deletable on it. 3. Removing property $deleted (and all related annotations) 4. Symfony commands: `php app/console doctrine:cache:clear-metadata php app/console doctrine:cache:clear-query php app/console doctrine:cache:clear-result php app/console cache:clear --env=prod --no-debug <-- error on this command` 5. [ReflectionException] Property Entity::$deleted does not exist Trace: ```#0 \vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataInfo.php(989) #1 \vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php(571) #2 \vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php(210) <-- CacheRedis driver called here #3 \vendor\doctrine\common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php(114) #4 \vendor\symfony\symfony\src\Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer.php(69) #5 \vendor\symfony\symfony\src\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate.php(48) #6 \app\bootstrap.php.cache(2513) #7 \app\bootstrap.php.cache(2284) #8 \vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php(128) #9 \vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php(90) #10 \vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php(252) #11 \vendor\symfony\symfony\src\Symfony\Component\Console\Application.php(894) #12 \vendor\symfony\symfony\src\Symfony\Component\Console\Application.php(193) #13 \vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php(96) #14 \vendor\symfony\symfony\src\Symfony\Component\Console\Application.php(124) #15 \app\console(27)``` Why do i think this is a Doctrine bug and not a Symfony bug? Because `php app/console doctrine:cache:clear-metadata php app/console doctrine:cache:clear-query php app/console doctrine:cache:clear-result` have been called successfully so RedisCache should not return cache with $this->fieldMappings containing key "deleted"
admin added the Bug label 2026-01-22 14:33:30 +01:00
Author
Owner

@doctrinebot commented on GitHub (Nov 30, 2014):

Comment created by everheij:

As a workaround I figured out that when you add the --flush flag it works as expected. You can read some documentation about what's going in this file; https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/MetadataCommand.php#L44.

orm:clear-cache:metadata --flush

@doctrinebot commented on GitHub (Nov 30, 2014): Comment created by everheij: As a workaround I figured out that when you add the --flush flag it works as expected. You can read some documentation about what's going in this file; https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Console/Command/ClearCache/MetadataCommand.php#L44. orm:clear-cache:metadata --flush
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4001