/** * Tries to find the PHP class mapping Doctrine\OrientDB's $OClass in each of the * directories where the documents are stored. * * @param string $OClass * * @return ClassMetadata * @throws MappingException * @throws OClassNotFoundException */ public function getMetadataForOClass($OClass) { if (isset($this->localOClassCache[$OClass])) { return $this->getMetadataFor($this->localOClassCache[$OClass]); } $cache = $this->getCacheDriver(); if (!($cached = $cache->fetch('oclassmap' . $this->cacheSalt))) { $cached = []; /** @var ClassMetadata $md */ foreach ($this->getAllMetadata() as $md) { $orientClass = $md->getOrientClass(); if (isset($cached[$orientClass])) { $existing = $cached[$orientClass]; throw MappingException::duplicateOrientClassMapping($orientClass, $existing, $md->name); } $cached[$orientClass] = $md->getName(); } $cache->save('oclassmap' . $this->cacheSalt, $cached); } if (isset($cached[$OClass])) { return $this->getMetadataFor($cached[$OClass]); } throw new OClassNotFoundException($OClass); }