예제 #1
0
 private function parseMetadata($entityList, &$fileDependencies)
 {
     $cache = [];
     $annotationParser = new AnnotationParser();
     foreach ($entityList as $className) {
         $cache[$className] = $annotationParser->parseMetadata($className, $fileDependencies);
     }
     return $cache;
 }
 public function __construct(IStorage $cacheStorage, array $entityClassesMap, IRepositoryLoader $repositoryLoader)
 {
     $cache = new Cache($cacheStorage, 'Nextras.Orm.metadata');
     static::$metadata = $cache->load($entityClassesMap, function (&$dp) use($entityClassesMap, $repositoryLoader) {
         $metadata = [];
         $annotationParser = new AnnotationParser($entityClassesMap);
         foreach (array_keys($entityClassesMap) as $className) {
             $metadata[$className] = $annotationParser->parseMetadata($className, $dp[Cache::FILES]);
         }
         $validator = new MetadataValidator();
         $validator->validate($metadata, $repositoryLoader);
         return $metadata;
     });
 }