Open Warxcell opened 3 years ago
I discovered that this method usually break up randomly. so I ended up like that:
EntityEnum.php
<?php
declare(strict_types=1);
class_alias(NonEntityEnm::class, 'EntityEnum');
@Warxcell thanks for the bug report. I will find out how to solve it for you.
In general, I'm going to suspend the whole development of this repository but will keep updates for people who already using it. I've mentioned it here as well: https://github.com/dbalabka/php-enumeration/issues/17#issuecomment-781670458
I doubt it there is a fix for that. At least I couldn't figure it out. Just posted here to be known for everybody. :)
Doctrine is using manually
require_once
and if it happens Enum class to be in Entity folder - It bypasses the autoloader and __constructStatic is never called.https://github.com/doctrine/persistence/blob/2.1.x/lib/Doctrine/Persistence/Mapping/Driver/AnnotationDriver.php#L234
I don't have idea how to fix it generally. For quick fix in my code i did intermediate class.
so when Doctrine
require_once 'EntityEnum.php';
it will lead autoloader toNonEntityEnum
and it will call the constructStatic.