use Consistence\Doctrine\Enum\Type\BooleanEnumType;
use Consistence\Doctrine\Enum\Type\FloatEnumType;
use Consistence\Doctrine\Enum\Type\IntegerEnumType;
use Consistence\Doctrine\Enum\Type\StringEnumType;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\DBAL\Types\Type as DoctrineType;
// path to your Composer autoload file
$loader = ass); // float_enum
DoctrineType::addType(IntegerEnumType::NAME, IntegerEnumType::class); // integer_enum
DoctrineType::addType(StringEnumType::NAME, StringEnumType::class); // string_enum
use Consistence\Doctrine\Enum\EnumPostLoadEntityListener;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\ORM\Events;
/** @var \Doctrine\ORM\EntityManager $entityManager */
/** @var \Doctrine\ORM\Mapping\Driver\AnnotationDriver $annotationDriver */
$annotationDriver = $entityManager->getConfiguration()->getMetadataDriverImpl();
$annotationReader = $annotationDriver->getReader();
// make sure to use the most appropriate cache for given environment to get the best performance
$cache = new ArrayCache();
$entityManager->getEventManager()->addEventListener(
Events::postLoad,
new EnumPostLoadEntityListener($annotationReader, $cache)
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.