/**
  * @see SMWStore::doDataUpdate
  *
  * @since 1.8
  * @param SMWSemanticData $data
  */
 public function doDataUpdate(SMWSemanticData $semanticData)
 {
     wfRunHooks('SMWSQLStore3::updateDataBefore', array($this->store, $semanticData));
     $subject = $semanticData->getSubject();
     // Reset diff before starting the update
     $this->propertyTableRowDiffer->resetCompositePropertyTableDiff();
     // Update data about our main subject
     $this->doFlatDataUpdate($semanticData);
     // Update data about our subobjects
     $subSemanticData = $semanticData->getSubSemanticData();
     foreach ($subSemanticData as $subobjectData) {
         $this->doFlatDataUpdate($subobjectData);
     }
     // Delete data about other subobjects no longer used
     $subobjects = $this->getSubobjects($subject);
     foreach ($subobjects as $smw_id => $subobject) {
         if (!$semanticData->hasSubSemanticData($subobject->getSubobjectName())) {
             $this->doFlatDataUpdate(new SMWSemanticData($subobject));
             $this->store->getObjectIds()->updateInterwikiField($smw_id, $subobject, SMW_SQL3_SMWDELETEIW);
         }
     }
     // Deprecated since 2.3, use SMW::SQLStore::AfterDataUpdateComplete
     wfRunHooks('SMWSQLStore3::updateDataAfter', array($this->store, $semanticData));
     wfRunHooks('SMW::SQLStore::AfterDataUpdateComplete', array($this->store, $semanticData, $this->propertyTableRowDiffer->getCompositePropertyTableDiff()));
 }
 public function testCompositePropertyTableDiffIteratorWithUnknownFixedProperty()
 {
     $propertyTable = $this->getMockBuilder('\\SMW\\SQLStore\\TableDefinition')->disableOriginalConstructor()->getMock();
     $propertyTable->expects($this->once())->method('usesIdSubject')->will($this->returnValue(true));
     $propertyTable->expects($this->once())->method('isFixedPropertyTable')->will($this->returnValue(true));
     $propertyTable->expects($this->once())->method('getFixedProperty')->will($this->returnValue('_UNKNOWN_FIXED_PROPERTY'));
     $semanticData = new SemanticData(new DIWikiPage('Foo', NS_MAIN));
     $propertyTables = array($propertyTable);
     $store = $this->getMockBuilder('\\SMW\\SQLStore\\SQLStore')->setMethods(array('getPropertyTables'))->getMock();
     $store->expects($this->any())->method('getPropertyTables')->will($this->returnValue($propertyTables));
     $instance = new PropertyTableRowDiffer($store);
     $instance->resetCompositePropertyTableDiff();
     $result = $instance->computeTableRowDiffFor(42, $semanticData);
     $this->assertInstanceOf('\\SMW\\SQLStore\\CompositePropertyTableDiffIterator', $instance->getCompositePropertyTableDiff());
     $this->assertEmpty($instance->getCompositePropertyTableDiff()->getFixedPropertyRecords());
 }
 /**
  * @see SMWStore::doDataUpdate
  *
  * @since 1.8
  * @param SMWSemanticData $data
  */
 public function doDataUpdate(SMWSemanticData $semanticData)
 {
     \Hooks::run('SMWSQLStore3::updateDataBefore', array($this->store, $semanticData));
     $subject = $semanticData->getSubject();
     $this->entitySubobjectListIterator->setSubject($subject);
     // Reset diff before starting the update
     $this->propertyTableRowDiffer->resetCompositePropertyTableDiff();
     // Update data about our main subject
     $this->doFlatDataUpdate($semanticData);
     // Update data about our subobjects
     $subSemanticData = $semanticData->getSubSemanticData();
     $subobjects = $this->entitySubobjectListIterator->getIterator();
     foreach ($subSemanticData as $subobjectData) {
         $this->doFlatDataUpdate($subobjectData);
     }
     // Mark subobjects without reference to be deleted
     foreach ($subobjects as $subobject) {
         if (!$semanticData->hasSubSemanticData($subobject->getSubobjectName())) {
             $this->doFlatDataUpdate(new SMWSemanticData($subobject));
             $this->store->getObjectIds()->updateInterwikiField($subobject->getId(), $subobject, SMW_SQL3_SMWDELETEIW);
         }
     }
     // Deprecated since 2.3, use SMW::SQLStore::AfterDataUpdateComplete
     \Hooks::run('SMWSQLStore3::updateDataAfter', array($this->store, $semanticData));
     \Hooks::run('SMW::SQLStore::AfterDataUpdateComplete', array($this->store, $semanticData, $this->propertyTableRowDiffer->getCompositePropertyTableDiff()));
 }
 public function testCompositePropertyTableDiffIterator()
 {
     $semanticData = new SemanticData(new DIWikiPage('Foo', NS_MAIN));
     $propertyTables = array();
     $store = $this->getMockBuilder('\\SMW\\SQLStore\\SQLStore')->setMethods(array('getPropertyTables'))->getMock();
     $store->expects($this->any())->method('getPropertyTables')->will($this->returnValue($propertyTables));
     $instance = new PropertyTableRowDiffer($store);
     $instance->resetCompositePropertyTableDiff();
     $result = $instance->computeTableRowDiffFor(42, $semanticData);
     $this->assertInstanceOf('\\SMW\\SQLStore\\CompositePropertyTableDiffIterator', $instance->getCompositePropertyTableDiff());
 }