* the new revision will act as a null-revision.
*
* @param RevisionRecord $parent
- * @param CommentStoreComment $comment
- * @param UserIdentity $user
- * @param string $timestamp
*
* @return MutableRevisionRecord
*/
- public static function newFromParentRevision(
- RevisionRecord $parent,
- CommentStoreComment $comment,
- UserIdentity $user,
- $timestamp
- ) {
+ public static function newFromParentRevision( RevisionRecord $parent ) {
// TODO: ideally, we wouldn't need a Title here
$title = Title::newFromLinkTarget( $parent->getPageAsLinkTarget() );
$rev = new MutableRevisionRecord( $title, $parent->getWikiId() );
- $rev->setComment( $comment );
- $rev->setUser( $user );
- $rev->setTimestamp( $timestamp );
-
foreach ( $parent->getSlotRoles() as $role ) {
$slot = $parent->getSlot( $role, self::RAW );
$rev->inheritSlot( $slot );
* @param SlotRecord $parentSlot
*/
public function inheritSlot( SlotRecord $parentSlot ) {
- $slot = SlotRecord::newInherited( $parentSlot );
- $this->setSlot( $slot );
+ $this->mSlots->inheritSlot( $parentSlot );
+ $this->resetAggregateValues();
}
/**
$this->resetAggregateValues();
}
+ /**
+ * Applies the given update to the slots of this revision.
+ *
+ * @param RevisionSlotsUpdate $update
+ */
+ public function applyUpdate( RevisionSlotsUpdate $update ) {
+ $update->apply( $this->mSlots );
+ }
+
/**
* @param CommentStoreComment $comment
*/
return $this->mSha1;
}
+ /**
+ * Returns the slots defined for this revision as a MutableRevisionSlots instance,
+ * which can be modified to defined the slots for this revision.
+ *
+ * @return MutableRevisionSlots
+ */
+ public function getSlots() {
+ // Overwritten just guarantee the more narrow return type.
+ return parent::getSlots();
+ }
+
/**
* Invalidate cached aggregate values such as hash and size.
*/