MediaWiki REL1_35
MediaWiki\Revision\RevisionFactory Interface Reference

Service for constructing revision objects. More...

Inheritance diagram for MediaWiki\Revision\RevisionFactory:
Collaboration diagram for MediaWiki\Revision\RevisionFactory:

Public Member Functions

 newMutableRevisionFromArray (array $fields, $queryFlags=self::READ_NORMAL, Title $title=null)
 Constructs a new RevisionRecord based on the given associative array following the MW1.29 database convention for the Revision constructor.
 
 newRevisionFromArchiveRow ( $row, $queryFlags=self::READ_NORMAL, Title $title=null, array $overrides=[])
 Make a fake revision object from an archive table row.
 
 newRevisionFromRow ( $row, $queryFlags=self::READ_NORMAL, Title $title=null)
 Constructs a RevisionRecord given a database row and content slots.
 

Additional Inherited Members

- Public Attributes inherited from IDBAccessObject
const READ_LOCKING = self::READ_LATEST | 2
 Constants for object loading bitfield flags (higher => higher QoS)
 
const READ_NONE = -1
 

Detailed Description

Service for constructing revision objects.

Since
1.31
1.32 Renamed from MediaWiki\Storage\RevisionFactory
Note
This was written to act as a drop-in replacement for the corresponding static methods in Revision.

Definition at line 38 of file RevisionFactory.php.

Member Function Documentation

◆ newMutableRevisionFromArray()

MediaWiki\Revision\RevisionFactory::newMutableRevisionFromArray ( array  $fields,
  $queryFlags = self::READ_NORMAL,
Title  $title = null 
)

Constructs a new RevisionRecord based on the given associative array following the MW1.29 database convention for the Revision constructor.

MCR migration note: this replaces Revision::newFromRow

Deprecated:
since 1.31. Use a MutableRevisionRecord instead.
Parameters
array$fields
int$queryFlagsFlags for lazy loading behavior, see IDBAccessObject::READ_XXX.
Title | null$title
Returns
MutableRevisionRecord
Exceptions
MWException

Implemented in MediaWiki\Revision\RevisionStore.

◆ newRevisionFromArchiveRow()

MediaWiki\Revision\RevisionFactory::newRevisionFromArchiveRow (   $row,
  $queryFlags = self::READ_NORMAL,
Title  $title = null,
array  $overrides = [] 
)

Make a fake revision object from an archive table row.

This is queried for permissions or even inserted (as in Special:Undelete)

MCR migration note: this replaces Revision::newFromArchiveRow

Parameters
object$rowA query result row as a raw object. Use RevisionStore::getArchiveQueryInfo() to build a query that yields the required fields.
int$queryFlagsFlags for lazy loading behavior, see IDBAccessObject::READ_XXX.
Title | null$title
array$overridesAn associative array that allows fields in $row to be overwritten. Keys in this array correspond to field names in $row without the "ar_" prefix, so $overrides['user'] will override $row->ar_user, etc.
Returns
RevisionRecord

Implemented in MediaWiki\Revision\RevisionStore.

◆ newRevisionFromRow()

MediaWiki\Revision\RevisionFactory::newRevisionFromRow (   $row,
  $queryFlags = self::READ_NORMAL,
Title  $title = null 
)

Constructs a RevisionRecord given a database row and content slots.

MCR migration note: this replaces Revision::newFromRow for rows based on the revision, slot, and content tables defined for MCR since MW1.31.

Parameters
object$rowA query result row as a raw object. Use RevisionStore::getQueryInfo() to build a query that yields the required fields.
int$queryFlagsFlags for lazy loading behavior, see IDBAccessObject::READ_XXX.
Title | null$titleA title object for the revision. Use Title::newFromRow when query was built with option 'page' on RevisionStore::getQueryInfo for performance reason
Returns
RevisionRecord

The documentation for this interface was generated from the following file: