private function buildDefinitionsForPropertyTables() { $enabledSpecialProperties = $this->fixedSpecialProperties; $customizableSpecialProperties = array_flip($this->customizableSpecialProperties); foreach ($this->customSpecialPropertyList as $property) { if (isset($customizableSpecialProperties[$property])) { $enabledSpecialProperties[] = $property; } } $definitionBuilder = new PropertyTableDefinitionBuilder($this->defaultDiTypeTableIdMap, $enabledSpecialProperties, $this->customFixedPropertyList); $definitionBuilder->doBuild(); $this->propertyTableDefinitions = $definitionBuilder->getTableDefinitions(); $this->fixedPropertyTableIds = $definitionBuilder->getFixedPropertyTableIds(); }
public function testRedirects() { $propertyKey = '_REDI'; $dataItems = array(); $specials = array($propertyKey); $fixed = array(); $instance = new PropertyTableDefinitionBuilder($dataItems, $specials, $fixed); $instance->doBuild(); $tableName = $instance->getTablePrefix() . strtolower($propertyKey); $definition = $instance->newTableDefinition(DataItem::TYPE_WIKIPAGE, $tableName, $propertyKey); $expected = array($tableName => $definition); $tableDefinitions = $instance->getTableDefinitions(); $this->assertFalse($tableDefinitions[$tableName]->usesIdSubject()); }
/** * Return the array of predefined property table declarations, initialising * it if necessary. The result is an array of SMWSQLStore3Table objects * indexed by table ids. * * It is ensured that the keys of the returned array agree with the name of * the table that they refer to. * * @since 1.8 * @return TableDefinition[] */ public function getPropertyTables() { // Definitions are kept static to prevent them from being initialised twice if (isset(self::$prop_tables)) { return self::$prop_tables; } $enabledSpecialProperties = self::$fixedSpecialProperties; $customizableSpecialProperties = array_flip(self::$customizableSpecialProperties); $customFixedProperties = self::$configuration->get('smwgFixedProperties'); $customSpecialProperties = self::$configuration->get('smwgPageSpecialProperties'); foreach ($customSpecialProperties as $property) { if (isset($customizableSpecialProperties[$property])) { $enabledSpecialProperties[] = $property; } } $definitionBuilder = new PropertyTableDefinitionBuilder(self::$di_type_tables, $enabledSpecialProperties, $customFixedProperties); $definitionBuilder->runBuilder(); self::$prop_tables = $definitionBuilder->getTableDefinitions(); self::$fixedPropertyTableIds = $definitionBuilder->getTableIds(); return self::$prop_tables; }