/**
  * Convenience wrapper offering the legacy Status based interface for saving
  * Entities.
  *
  * @todo: rewrite the tests using this
  *
  * @param WikiPageEntityStore $store
  * @param Entity $entity
  * @param string $summary
  * @param User $user
  * @param int $flags
  * @param bool $baseRevId
  *
  * @return Status
  */
 protected function saveEntity(WikiPageEntityStore $store, Entity $entity, $summary = '', User $user = null, $flags = 0, $baseRevId = false)
 {
     if ($user === null) {
         $user = $GLOBALS['wgUser'];
     }
     try {
         $rev = $store->saveEntity($entity, $summary, $user, $flags, $baseRevId);
         $status = Status::newGood(Revision::newFromId($rev->getRevisionId()));
     } catch (StorageException $ex) {
         $status = $ex->getStatus();
         if (!$status) {
             $status = Status::newFatal('boohoo');
         }
     }
     return $status;
 }
 /**
  * @return WikiPageEntityStore
  */
 private function newEntityStore()
 {
     $contentFactory = WikibaseRepo::getDefaultInstance()->getEntityContentFactory();
     $idGenerator = $this->newIdGenerator();
     $store = new WikiPageEntityStore($contentFactory, $idGenerator);
     $store->registerWatcher($this->getEntityStoreWatcher());
     return $store;
 }