コード例 #1
0
 public function testCanConstructMappingIterator()
 {
     $instance = new IteratorFactory();
     $iterator = $this->getMockBuilder('\\Iterator')->disableOriginalConstructor()->getMock();
     $this->assertInstanceOf('\\SMW\\Iterators\\MappingIterator', $instance->newMappingIterator($iterator, function () {
     }));
 }
コード例 #2
0
 /**
  * @since 2.3
  *
  * @param array $idList
  *
  * @return DIWikiPage[]
  */
 public function getDataItemPoolHashListFor(array $idList)
 {
     $rows = $this->connection->select(\SMWSQLStore3::ID_TABLE, array('smw_title', 'smw_namespace', 'smw_iw', 'smw_subobject'), array('smw_id' => $idList), __METHOD__);
     $resultIterator = $this->iteratorFactory->newResultIterator($rows);
     $mappingIterator = $this->iteratorFactory->newMappingIterator($resultIterator, function ($row) {
         return HashBuilder::createHashIdFromSegments($row->smw_title, $row->smw_namespace, $row->smw_iw, $row->smw_subobject);
     });
     return $mappingIterator;
 }
コード例 #3
0
 private function newResultIterator(DIWikiPage $subject)
 {
     $connection = $this->store->getConnection('mw.db');
     $dbKey = $subject->getDBkey();
     // #1955 Ensure to match a possible predefined property
     // (Modification date -> _MDAT)
     if ($subject->getNamespace() === SMW_NS_PROPERTY) {
         $dbKey = DIProperty::newFromUserLabel($subject->getDBkey())->getKey();
     }
     $condition = 'smw_title = ' . $connection->addQuotes($dbKey) . ' AND ' . 'smw_namespace = ' . $connection->addQuotes($subject->getNamespace()) . ' AND ' . 'smw_iw = ' . $connection->addQuotes($subject->getInterwiki()) . ' AND ' . 'smw_subobject != ' . $connection->addQuotes('');
     foreach ($this->skipOn as $skipOn) {
         $condition .= ' AND smw_subobject != ' . $connection->addQuotes($skipOn);
     }
     $res = $connection->select($connection->tablename(SQLStore::ID_TABLE), array('smw_id', 'smw_subobject', 'smw_sortkey'), $condition, __METHOD__);
     return $this->iteratorFactory->newResultIterator($res);
 }