/** * @throws \Doctrine\ORM\ORMException */ public function boot() { $this->serializer = SerializerBuilder::create()->setDebug($this->devMode)->build(); $this->entityFolder->create(); AnnotationRegistry::registerAutoloadNamespace('JMS\\Serializer\\Annotation', __DIR__ . '/../../../../vendor/jms/serializer/src'); $proxyDoctrineFolder = new Folder(sys_get_temp_dir() . '/doctrine'); $config = Setup::createAnnotationMetadataConfiguration([$this->entityFolder->absolute()], $this->isDevMode(), $proxyDoctrineFolder->absolute()); if ($this->cache !== null) { $config->setQueryCacheImpl($this->getCache()); $config->setResultCacheImpl($this->getCache()); } $this->entityManager = $this->createEntityManager($config); $debugStack = new DebugStack(); $this->entityManager->getConnection()->getConfiguration()->setSQLLogger($debugStack); if ($this->getFileCreation()->getContent() == 1) { return; } if ($proxyDoctrineFolder->isFolder()) { $proxyDoctrineFolder->removeFiles(); } $tool = new SchemaTool($this->entityManager); $metadatas = $this->entityManager->getMetadataFactory()->getAllMetadata(); $proxyDoctrineFolder->create(); $this->entityManager->getProxyFactory()->generateProxyClasses($metadatas, $proxyDoctrineFolder->absolute()); if ($this->cloudFoundryBoot->isInCloudFoundry()) { $tool->updateSchema($metadatas); } else { $tool->createSchema($metadatas); } $this->getFileCreation()->setContent(1); }
private function loadAnnotationFromCache() { $annotationsFolder = new Folder(sys_get_temp_dir() . DIRECTORY_SEPARATOR . SphringCacheEnum::CACHE_FOLDER . DIRECTORY_SEPARATOR . SphringCacheEnum::CACHE_FOLDER_ANNOTATIONS); $annotationsFolder->create(); $reader = new CachedReader(new AnnotationReader(), new FilesystemCache($annotationsFolder->absolute())); $sphringBoot = $this->sphring->getSphringEventDispatcher()->getSphringBoot(); $sphringBoot->getSphringAnnotationReader()->setReader($reader); }