/** * Returns metadata for the specified object class name * Class can also be specified in short notation (e.g AppBundle:ObjCategory) * * @param string $objectClass * @return array * @throw Exception */ public function getObjectPropertiesMetadata($objectClass) { $objectMetadata = null; $objectClass = $this->documentLocator->getShortClassName($objectClass); if (isset($this->objectsMetadata[$objectClass])) { return $this->objectsMetadata[$objectClass]; } else { // If we have it cached and up-to-date, get the data from cache if ($this->cache->fetch('[C]' . self::OBJECTS_CACHE_KEY . $objectClass) > $this->documentsLastModifiedTime) { $objectMetadata = $this->cache->fetch(self::OBJECTS_CACHE_KEY . $objectClass); } // Get the metadata the slow way and put it in the cache if (!$objectMetadata) { $objectMetadata = $this->parser->getPropertiesMetadata(new \ReflectionClass($this->documentLocator->resolveClassName($objectClass))); $this->cache->save(self::OBJECTS_CACHE_KEY . $objectClass, $objectMetadata); $this->cache->save('[C]' . self::OBJECTS_CACHE_KEY . $objectClass, time()); } } if (!is_array($objectMetadata)) { throw new Exception(sprintf('Metadata for object "%s" could not be retrieved', $objectClass)); } // Cache the value in the class as well $this->objectsMetadata[$objectClass] = $objectMetadata; return $objectMetadata; }