Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to retrieve the reflection object for documents with enum #350

Closed
yunicot opened this issue Mar 10, 2024 · 1 comment · Fixed by #351
Closed

Failed to retrieve the reflection object for documents with enum #350

yunicot opened this issue Mar 10, 2024 · 1 comment · Fixed by #351
Labels
Bug Something isn't working
Milestone

Comments

@yunicot
Copy link
Contributor

yunicot commented Mar 10, 2024

I am using:
php 8.3.3
symfony 6.4
doctrine/mongodb-odm (v2.6.3)

When I try to dump the document with enum I get the error "Internal error: Failed to retrieve the reflection object"

Exception trace:
  at /srv/app/vendor/symfony/var-dumper/Caster/ReflectionCaster.php:344
 ReflectionProperty->getModifiers() at /srv/app/vendor/symfony/var-dumper/Caster/ReflectionCaster.php:344
 Symfony\Component\VarDumper\Caster\ReflectionCaster::castProperty() at /srv/app/vendor/symfony/var-dumper/Cloner/AbstractCloner.php:363
 Symfony\Component\VarDumper\Cloner\AbstractCloner->castObject() at /srv/app/vendor/symfony/var-dumper/Cloner/VarCloner.php:130
 Symfony\Component\VarDumper\Cloner\VarCloner->doClone() at /srv/app/vendor/symfony/var-dumper/Cloner/AbstractCloner.php:302
 Symfony\Component\VarDumper\Cloner\AbstractCloner->cloneVar() at /srv/app/vendor/symfony/http-kernel/EventListener/DumpListener.php:49
 Symfony\Component\HttpKernel\EventListener\DumpListener::Symfony\Component\HttpKernel\EventListener\{closure}() at /srv/app/vendor/symfony/var-dumper/VarDumper.php:52
 Symfony\Component\VarDumper\VarDumper::dump() at /srv/app/vendor/symfony/var-dumper/Resources/functions/dump.php:53
 dd() at /srv/app/src/DataProvider/Infrastructure/Command/MigrateRepresentativeUserToEmployeeCommand.php:37
 App\DataProvider\Infrastructure\Command\MigrateRepresentativeUserToEmployeeCommand->execute() at /srv/app/vendor/symfony/console/Command/Command.php:326
 Symfony\Component\Console\Command\Command->run() at /srv/app/vendor/symfony/console/Application.php:1096
 Symfony\Component\Console\Application->doRunCommand() at /srv/app/vendor/symfony/framework-bundle/Console/Application.php:126
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /srv/app/vendor/symfony/console/Application.php:324
 Symfony\Component\Console\Application->doRun() at /srv/app/vendor/symfony/framework-bundle/Console/Application.php:80
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /srv/app/vendor/symfony/console/Application.php:175
 Symfony\Component\Console\Application->run() at /srv/app/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49
 Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run() at /srv/app/vendor/autoload_runtime.php:29
 require_once() at /srv/app/bin/console:13

After small research I found that the problem can be solved if add to EnumReflectionProperty next code:

    public function getModifiers(): int
    {
        return $this->originalReflectionProperty->getModifiers();
    }

    public function getDocComment(): string|false
    {
        return $this->originalReflectionProperty->getDocComment();
    }

I had this problem and before during at least 1 year, but it wasn't critical and just delayed to solving

@derrabus
Copy link
Member

Please send a PR that adds those.

@malarzm malarzm added the Bug Something isn't working label Mar 11, 2024
@malarzm malarzm added this to the 3.3.2 milestone Mar 11, 2024
@malarzm malarzm linked a pull request Mar 11, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants