/** * @GET * @POST */ public function update() { foreach (Runtime_Classloader::get()->getClasspaths() as $type => $path) { if (Entity_Default::TYPE !== $type) { $class = new \ReflectionClass($type); if ($class->isSubclassOf('Components\\Entity')) { $this->updateForEntity($type); } } } }
/** * Parses and caches annotations for given name of an annotated type if * not already cached. * * Retrieves neccessary information from cache and builds & returns * an instance of Annotations. * * @param string $type_ Name of annotated type. * * @return \Components\Annotations */ private static function resolveInstance($type_) { if (0 === strpos($type_, '\\')) { $type_ = ltrim($type_, '\\'); } $cacheKeyType = 'components/type/annotations/' . md5($type_); if (false === ($cached = Cache::get($cacheKeyType))) { // Pays off if classloader cache is built sufficiently ... if (!($typeLocation = Runtime_Classloader::get()->getClasspath($type_))) { $cacheKeyTypeLocation = "{$cacheKeyType}/file"; // ... yet requires fallback for out-of-control classloaders (e.g. during unit test execution). if (false === ($typeLocation = Cache::get($cacheKeyTypeLocation))) { $type = new \ReflectionClass($type_); $typeLocation = $type->getFileName(); Cache::set($cacheKeyTypeLocation, $typeLocation); } } $annotations = self::parseAnnotations($typeLocation); foreach ($annotations as $type => $typeAnnotations) { Cache::set($cacheKeyType, $typeAnnotations); } $instance = new self($type_); $instance->m_annotations = $annotations[$type_]; } else { $instance = new self($type_); $instance->m_annotations = $cached; } return $instance; }