Пример #1
0
 /**
  * Constructor
  *
  * @param XMLASchema Schema
  * @param string     name Name
  * @param string     description Description
  *
  * @throws OLAPException
  */
 public function __construct(XMLASchema $schema, $name, $description)
 {
     assert($schema != null);
     assert($name != null);
     assert($description != null);
     $this->schema = $schema;
     $this->name = $name;
     $this->description = $description;
     $this->metadataReader = new XMLACachingMetadataReader(new XMLAMetadataReader($this), $this->measuresMap);
     $connection = $schema->getCatalog()->getMetaData()->getConnection();
     $context = XMLAConnectionContext::createAtGranule($this, null, null, null);
     $restrictions = array('CATALOG_NAME' => $schema->getCatalog()->getName(), 'SCHEMA_NAME' => $schema->getName(), 'CUBE_NAME' => $this->getName());
     $this->dimensions = new LazyMetadataList(new XMLAMetadataRequest(XMLAMetadataRequest::MDSCHEMA_DIMENSIONS), $context, new XMLADimensionHandler($this), $restrictions);
     // populate measures up front; a measure is needed in every query
     $this->measures = new NamedList();
     $connection->populateList($this->measures, $context, new XMLAMetadataRequest(XMLAMetadataRequest::MDSCHEMA_MEASURES), new XMLAMeasureHandler($this->getDimensions()->get('Measures')), $restrictions);
     for ($i = 0; $i < $this->measures->size(); $i++) {
         $measure = $this->measures->get($i);
         $this->measuresMap[$measure->getUniqueName()] = $measure;
     }
     // populate named sets
     $this->namedSets = new LazyMetadataList(new XMLAMetadataRequest(XMLAMetadataRequest::MDSCHEMA_SETS), $context, new XMLANamedSetHandler(), $restrictions);
 }
 /**
  * Shorthand way to create a Context at Level level.
  *
  * @param XMLALevel Level (must not be null)
  */
 public static function createAtLevel(XMLALevel $level)
 {
     return XMLAConnectionContext::createAtGranule($level->getHierarchy()->getDimension()->getCube(), $level->getHierarchy()->getDimension(), $level->getHierarchy(), $level);
 }
Пример #3
0
 /**
  * Looks a member by its unique name and returns members related by
  * the specified tree-operations.
  *
  * @param array  treeOps Collection of tree operations to travel relative to
  *               given member in order to create list of members
  *
  * @param string memberUniqueName Unique name of member
  *
  * @param array  IMember List to be populated with members related to the given
  *               member, or empty set if the member is not found
  *
  * @throws OLAPException if error occurs
  */
 public function lookupMemberRelatives(array $treeOps, $memberUniqueName, NamedList $list)
 {
     $context = XMLAConnectionContext::createAtGranule($this->cube, null, null, null);
     $treeOpMask = 0;
     foreach ($treeOps as $treeOp) {
         $treeOpMask |= $treeOp->xmlaOrdinal();
     }
     $this->cube->getSchema()->getCatalog()->getMetaData()->getConnection()->populateList($list, $context, new XMLAMetadataRequest(XMLAMetadataRequest::MDSCHEMA_MEMBERS), new XMLAMemberHandler(), array('CATALOG_NAME' => $this->cube->getSchema()->getCatalog()->getName(), 'SCHEMA_NAME' => $this->cube->getSchema()->getName(), 'CUBE_NAME' => $this->cube->getName(), 'MEMBER_UNIQUE_NAME' => $memberUniqueName, 'TREE_OP' => $treeOpMask));
 }