-
-
Notifications
You must be signed in to change notification settings - Fork 70
Description
Bug Report
Q | A |
---|---|
Version | 4.0.0 |
Versions < 4.0.0 are more than likely also impacted by this bug.
Summary
Hello, I am the developer of DoctrineDiagramBundle
. With this bundle I can generate class diagrams from my Doctrine entities.
The problem is that when an entity has a Enum type property my bundle fails and throws a Fatal error.
After some hours of research I identified the problem: some methods in \Doctrine\Persistence\Reflection\EnumReflectionProperty
don't work properly and generate a fatal error.
More precisely, any inherited method in EnumReflectionProperty
will generate an error.
Internal error: Failed to retrieve the reflection object
Current behavior
Methods defined in EnumReflectionProperty
work as expected, for example:
\Doctrine\Persistence\Reflection\EnumReflectionProperty::getName
Ok\Doctrine\Persistence\Reflection\EnumReflectionProperty::isPrivate
Ok
But methods inherited from parent will fail, for example:
\Doctrine\Persistence\Reflection\EnumReflectionProperty::hasDefaultValue
Fatal error\Doctrine\Persistence\Reflection\EnumReflectionProperty::isPublic
Fatal error
Expected behavior
All methods from EnumReflectionProperty
must work properly without any error.
How to reproduce
To reproduce the issue simply call any inherited method in EnumReflectionProperty
.
I reproduced the issue installing and using DoctrineDiagramBundle:
- Install jawira/doctrine-diagram-bundle.
- Create an entity with an Enum type property, this property must also be a Doctrine property. This is described in the original issue:
Property::generateVisibility() chashes if property is an EnumReflectionProperty jawira/entity-draw#17. - Execute
bin/console doctrine:diagram:class
and voila, you get Fatal error.
Solution
As per documentation, when a Reflection class is extended and constructor overwritten, then the parent's constructor must also be called.
Source: https://www.php.net/manual/en/reflection.extending.php
I have created a PR that fixes this issue: #422