byfareska / doctrine-in-wordpress
DIW: Doctrine in wordpress
1.0.0
2022-05-06 07:48 UTC
Requires
- php: ^8
- doctrine/orm: ^2
This package is not auto-updated.
Last update: 2024-11-16 17:53:15 UTC
README
-
composer req byfareska/doctrine-in-wordpress
$config = new Configuration(); $config->setProxyDir(__DIR__ . '/var/cache'); $config->setProxyNamespace('EntityProxy'); $config->setAutoGenerateProxyClasses(true); $config->setMetadataDriverImpl(new \Doctrine\ORM\Mapping\Driver\AttributeDriver([ __DIR__ . '/src/Entity' ])); $metaDataFactory = new \Doctrine\ORM\Mapping\ClassMetadataFactory(); $em = (new \Byfareska\WordpressDoctrineOrm\EntityManagerFactory())->create(); $metaDataFactory->setEntityManager($em); $meta = $metaDataFactory->getMetadataFor(ExampleEntity::class); $repository = new ExampleRepository($em, $meta); var_dump($repository->findAll());