protected function registerDatasets(SystemTableMetaModelLoaderCallContext $callcontext, AbstractMetaModel $metamodel) { $datasetCount = 0; $loaderName = $this->getName(); // registering eligible datasets foreach ($callcontext->datasets as $tableAccessKey => $dataset) { $dataset->loaderName = $loaderName; $dataset->markAsComplete(); $existingDataset = $metamodel->findDataset($dataset->name, TRUE); if (isset($existingDataset)) { throw new IllegalStateException(t( 'Found several references to the same table: %existingTableReference, %tableReference', array( '%existingTableReference' => $existingDataset->source, '%tableReference' => $dataset->source))); } $metamodel->registerDataset($dataset); $datasetCount++; } LogHelper::log_info(t('Registered @datasetCount datasets', array('@datasetCount' => $datasetCount))); }
protected function mergeWithCube(AbstractMetaModel $metamodel, array $filters = NULL, $namespace, $sourceCubeName, $sourceCube) { $cubeName = NameSpaceHelper::resolveNameSpace($namespace, $sourceCubeName); // cube/sourceDataset/Name if (!isset($sourceCube->factsDatasetName)) { throw new IllegalStateException(t( '%cubeName cube definition does not contain a reference to facts dataset', array('%cubeName' => (isset($sourceCube->publicName) ? $sourceCube->publicName : $cubeName)))); } $sourceCube->factsDatasetName = NameSpaceHelper::resolveNameSpace($namespace, $sourceCube->factsDatasetName); // fix dimensions if (isset($sourceCube->dimensions)) { foreach ($sourceCube->dimensions as $dimension) { // cube/dimension/dataset/name if (!isset($dimension->datasetName)) { continue; } $dimension->datasetName = NameSpaceHelper::resolveNameSpace($namespace, $dimension->datasetName); } } $cube = new CubeMetaData(); $cube->name = $cubeName; $cube->initializeFrom($sourceCube); $isCubeAcceptable = $this->isMetaDataAcceptable($cube, $filters); // TODO eliminate this check in the future. Use different approach if ($isCubeAcceptable) { $isCubeAcceptable = $metamodel->findDataset($cube->factsDatasetName) !== NULL; } if ($isCubeAcceptable) { $metamodel->registerCube($cube); } return $cube; }