/**
  * @dataProvider diffDataProvider
  */
 public function testDiff($list, $fixedPropertyRecord, $expectedOrdered, $expectedList)
 {
     $instance = new CompositePropertyTableDiffIterator($list);
     $instance->addFixedPropertyRecord($fixedPropertyRecord[0], $fixedPropertyRecord[1]);
     $this->assertEquals($expectedOrdered, $instance->getOrderedDiffByTable());
     $this->assertEquals($expectedList, $instance->getCombinedIdListOfChangedEntities());
 }
 /**
  * @since 2.5
  *
  * @param CompositePropertyTableDiffIterator $compositePropertyTableDiffIterator
  *
  * @return null|string
  */
 public function createSlotFrom(CompositePropertyTableDiffIterator $compositePropertyTableDiffIterator)
 {
     $orderedDiffByTable = $compositePropertyTableDiffIterator->getOrderedDiffByTable();
     if ($orderedDiffByTable === array()) {
         return null;
     }
     $slot = $this->getSlot($compositePropertyTableDiffIterator);
     $this->cache->save($slot, $orderedDiffByTable);
     return $slot;
 }
 /**
  * This method is called from the `SMW::SQLStore::AfterDataUpdateComplete` hook and
  * removes outdated query ID's from the table if the diff contains a `delete`
  * entry for the _ask table.
  *
  * @since 2.3
  *
  * @param CompositePropertyTableDiffIterator $compositePropertyTableDiffIterator
  */
 public function pruneOutdatedTargetLinks(CompositePropertyTableDiffIterator $compositePropertyTableDiffIterator)
 {
     if (!$this->isEnabled()) {
         return null;
     }
     $tableName = $this->store->getPropertyTableInfoFetcher()->findTableIdForProperty(new DIProperty('_ASK'));
     $diff = $compositePropertyTableDiffIterator->getOrderedDiffByTable($tableName);
     // Remove any dependency for queries that are no longer used
     if (isset($diff[$tableName]['delete'])) {
         $deleteIdList = array();
         foreach ($diff[$tableName]['delete'] as $delete) {
             $deleteIdList[] = $delete['o_id'];
         }
         wfDebugLog('smw', __METHOD__ . ' remove ' . implode(',', $deleteIdList) . "\n");
         $this->connection->beginAtomicTransaction(__METHOD__);
         $this->connection->delete(SMWSQLStore3::QUERY_LINKS_TABLE, array('s_id' => $deleteIdList), __METHOD__);
         $this->connection->endAtomicTransaction(__METHOD__);
     }
     // Dispatch any event registered earlier during the QueryResult processing
     // that didn't match a sid
     EventHandler::getInstance()->getEventDispatcher()->dispatch('deferred.embedded.query.dep.update');
     EventHandler::getInstance()->getEventDispatcher()->removeListener('deferred.embedded.query.dep.update');
     return true;
 }