/**
  * Updates the property info entry for the given property.
  * The property is loaded in full using the EntityLookup
  * provide to the constructor.
  *
  * @throws RuntimeException
  *
  * @param PropertyId $id the Property to process
  */
 private function updatePropertyInfo(PropertyId $id)
 {
     $property = $this->entityLookup->getEntity($id);
     if (!$property instanceof Property) {
         throw new RuntimeException('EntityLookup did not return a Property for id ' . $id->getSerialization());
     }
     $info = $this->propertyInfoBuilder->buildPropertyInfo($property);
     $this->propertyInfoTable->setPropertyInfo($property->getId(), $info);
 }
 private function assertTableHasProperties(array $properties, PropertyInfoTable $table)
 {
     foreach ($properties as $propId => $expected) {
         $info = $table->getPropertyInfo(new PropertyId($propId));
         $this->assertEquals($expected[PropertyInfoStore::KEY_DATA_TYPE], $info[PropertyInfoStore::KEY_DATA_TYPE], "Property {$propId}");
         if (isset($expected[PropertyInfoStore::KEY_FORMATTER_URL])) {
             $this->assertEquals($expected[PropertyInfoStore::KEY_FORMATTER_URL], $info[PropertyInfoStore::KEY_FORMATTER_URL]);
         } else {
             $this->assertArrayNotHasKey(PropertyInfoStore::KEY_FORMATTER_URL, $info);
         }
     }
 }
 /**
  * Wrapper for invoking PropertyInfoTableBuilder from DatabaseUpdater
  * during a database update.
  *
  * @param DatabaseUpdater $updater
  */
 public static function rebuildPropertyInfo(DatabaseUpdater $updater)
 {
     $reporter = new ObservableMessageReporter();
     $reporter->registerReporterCallback(function ($msg) use($updater) {
         $updater->output("..." . $msg . "\n");
     });
     $table = new PropertyInfoTable(false);
     $wikibaseRepo = WikibaseRepo::getDefaultInstance();
     $contentCodec = $wikibaseRepo->getEntityContentDataCodec();
     $propertyInfoBuilder = $wikibaseRepo->newPropertyInfoBuilder();
     $wikiPageEntityLookup = new WikiPageEntityRevisionLookup($contentCodec, new WikiPageEntityMetaDataLookup($wikibaseRepo->getEntityIdParser()), false);
     $cachingEntityLookup = new CachingEntityRevisionLookup($wikiPageEntityLookup, new HashBagOStuff());
     $entityLookup = new RevisionBasedEntityLookup($cachingEntityLookup);
     $builder = new PropertyInfoTableBuilder($table, $entityLookup, $propertyInfoBuilder);
     $builder->setReporter($reporter);
     $builder->setUseTransactions(false);
     $updater->output('Populating ' . $table->getTableName() . "\n");
     $builder->rebuildPropertyInfo();
 }