MediaWiki  master
RowCommentFormatter.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use CommentStore;
6 use Traversable;
8 
17  private $commentStore;
18 
25  public function __construct(
26  CommentParserFactory $commentParserFactory,
27  CommentStore $commentStore
28  ) {
29  parent::__construct( $commentParserFactory );
30  $this->commentStore = $commentStore;
31  }
32 
49  public function rows( $rows ) {
50  return new RowCommentIterator( $this->commentStore, $rows );
51  }
52 
73  public function formatRows( $rows, $commentKey, $namespaceField = null, $titleField = null,
74  $indexField = null, $useBlock = false, $useParentheses = true
75  ) {
76  return $this->createBatch()
77  ->comments(
78  $this->rows( $rows )
79  ->commentKey( $commentKey )
80  ->namespaceField( $namespaceField )
81  ->titleField( $titleField )
82  ->indexField( $indexField )
83  )
84  ->useBlock( $useBlock )
85  ->useParentheses( $useParentheses )
86  ->execute();
87  }
88 }
Handle database storage of comments such as edit summaries and log reasons.
This is the main service interface for converting single-line comments from various DB comment fields...
createBatch()
Format comments using a fluent interface.
This is basically a CommentFormatter with a CommentStore dependency, allowing it to retrieve comment ...
formatRows( $rows, $commentKey, $namespaceField=null, $titleField=null, $indexField=null, $useBlock=false, $useParentheses=true)
Format DB rows using a parametric interface.
__construct(CommentParserFactory $commentParserFactory, CommentStore $commentStore)
rows( $rows)
Format DB rows using a fluent interface.
An adaptor which converts a row iterator into a CommentItem iterator for batch formatting.
Result wrapper for grabbing data queried from an IDatabase object.