Example #1
0
 private function importResource(array $data, LoadingCriteriaInterface $loadingCriteria, DelegatingLoader $delegatingLoader, Configuration $configuration)
 {
     $defaultResourceDir = $configuration->getDefaultClassMetadataResourceDir();
     if (isset($data['imports']['resources'])) {
         foreach ($data['imports']['resources'] as $resourceSettings) {
             $otherResourcePath = null;
             if (isset($resourceSettings['path'])) {
                 $otherResourcePath = $resourceSettings['path'];
                 if ('.' === ($otherResourceDir = dirname($otherResourcePath))) {
                     $otherResourcePath = $defaultResourceDir . '/' . $otherResourcePath;
                 }
             }
             $otherResourceType = null;
             if (isset($resourceSettings['type'])) {
                 $otherResourceType = $resourceSettings['type'];
             }
             $otherResourceClass = null;
             if (isset($resourceSettings['class'])) {
                 $otherResourceClass = $resourceSettings['class'];
             }
             $otherResourceMethod = null;
             if (isset($resourceSettings['method'])) {
                 $otherResourceMethod = $resourceSettings['method'];
             }
             $loadingCriteria = LoadingCriteria::create($otherResourcePath, $otherResourceType, $otherResourceClass, $otherResourceMethod);
             $delegatedLoader = $delegatingLoader->getDelegatedLoader($loadingCriteria);
             $othersData = $delegatedLoader->getData($loadingCriteria, $configuration, $delegatingLoader);
             $data = array_merge_recursive($othersData, $data);
         }
     }
     return $data;
 }