PhpEnums
PhpEnums copied to clipboard
Extra not found on Enum in production
I have a weird behavior using extra with my enums on my production server.
An Error Occurred! Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("No value for extra "color" for enum case App\Core\Enum\AlertStatus::Success")." at /srv/app/templates/components/alert.html.twig line 1
This does not happen in dev or test environment and all my tests passed 😕 .
Server specs:
- Symfony 6.2
- PHP 8.2.4
Project:
Have you ever encountered such a problem?
Hi. Did you clear the cache in prod env in between your changes?
symfony console c:c -e prod
Hello!
Yes, the cache is clear after each deployment
Ok, I think i can confirm this is due to calling getExtra()
If i use a simple match expression, there is no more errors in production!
I didn't encounter such an issue so far, though 🤷🏻♂️
same problem here, extra not found on Enum in production. I clear cache also but that not fix the issue