protected function prepareCubeRequestQueries(CubeQueryRequest $request, CubeMetaData $cube, array $parameters = NULL)
 {
     if (!isset($parameters)) {
         return;
     }
     $metamodel = data_controller_get_metamodel();
     foreach ($parameters as $parameterName => $parameterValues) {
         list($elementName, $subElementName, $propertyName) = ParameterHelper::splitName($parameterName);
         list($referencedDatasetName, $referencedElementName) = ReferencePathHelper::splitReference($elementName);
         // checking that referenced cube exists
         $referencedCube = isset($referencedDatasetName) ? $metamodel->getCubeByDatasetName($referencedDatasetName) : NULL;
         if (isset($subElementName)) {
             if (isset($referencedCube)) {
                 throw new IllegalArgumentException(t('Referenced dimensions are not supported'));
             }
             // checking the level exists
             $dimension = $cube->getDimension($elementName);
             $level = $dimension->getLevel($subElementName);
             // adding the dimension level related query
             $request->addDimensionLevelPropertyQueryValues($elementName, $subElementName, $propertyName, $parameterValues);
         } else {
             $selectedRequest = $request;
             if (isset($referencedCube)) {
                 $measure = $referencedCube->findMeasure($referencedElementName);
                 $selectedRequest = $request->registerReferencedRequest($referencedCube->name);
             } else {
                 // checking if the measure exists
                 $measure = $cube->findMeasure($referencedElementName);
             }
             if (isset($measure)) {
                 // adding measure query
                 $selectedRequest->addMeasureQueryValues($referencedElementName, $parameterValues);
             } else {
                 // adding dataset column-based query
                 $selectedRequest->addSourceDatasetPropertyQueryValues($referencedElementName, $parameterValues);
             }
         }
     }
 }
 public function adjustCubeCountRequest(DataControllerCallContext $callcontext, CubeQueryRequest $request)
 {
     list($dimensionName, $levelName, $propertyName) = ParameterHelper::splitName($this->enumerationPropertyName);
     // we have to find corresponding level in this request
     $isLevelFound = FALSE;
     if (isset($request->dimensions)) {
         foreach ($request->dimensions as $key => $dimension) {
             if ($dimension->dimensionName == $dimensionName && $dimension->levelName == $levelName) {
                 $isLevelFound = TRUE;
                 unset($request->dimensions[$key]);
                 break;
             }
         }
     }
     if (!$isLevelFound) {
         throw new IllegalStateException(t("Could not find configuration for '@levelName' level of '@dimensionName' dimension in the request", array('@dimensionName' => $dimensionName, '@levelName' => $levelName)));
     }
 }
Example #3
0
 public function __construct($columnName, $isSortAscending)
 {
     list($this->elementName, $this->subElementName, $this->elementPropertyName) = ParameterHelper::splitName($columnName);
     parent::__construct($columnName, $isSortAscending);
 }