MediaWiki  1.23.6
ORMResult.php
Go to the documentation of this file.
1 <?php
32 class ORMResult implements ORMIterator {
36  protected $res;
37 
41  protected $key;
42 
46  protected $current;
47 
51  protected $table;
52 
57  public function __construct( IORMTable $table, ResultWrapper $res ) {
58  $this->table = $table;
59  $this->res = $res;
60  $this->key = 0;
61  $this->setCurrent( $this->res->current() );
62  }
63 
67  protected function setCurrent( $row ) {
68  if ( $row === false ) {
69  $this->current = false;
70  } else {
71  $this->current = $this->table->newRowFromDBResult( $row );
72  }
73  }
74 
78  public function count() {
79  return $this->res->numRows();
80  }
81 
85  public function isEmpty() {
86  return $this->res->numRows() === 0;
87  }
88 
92  public function current() {
93  return $this->current;
94  }
95 
99  public function key() {
100  return $this->key;
101  }
102 
103  public function next() {
104  $row = $this->res->next();
105  $this->setCurrent( $row );
106  $this->key++;
107  }
108 
109  public function rewind() {
110  $this->res->rewind();
111  $this->key = 0;
112  $this->setCurrent( $this->res->current() );
113  }
114 
118  public function valid() {
119  return $this->current !== false;
120  }
121 }
ORMResult
Definition: ORMResult.php:32
ORMResult\setCurrent
setCurrent( $row)
Definition: ORMResult.php:63
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
IORMRow
Definition: IORMRow.php:34
ORMResult\$table
IORMTable $table
Definition: ORMResult.php:47
ORMResult\$key
integer $key
Definition: ORMResult.php:39
ORMResult\count
count()
Definition: ORMResult.php:74
IORMTable
Definition: IORMTable.php:30
ORMResult\$res
ResultWrapper $res
Definition: ORMResult.php:35
ORMResult\next
next()
Definition: ORMResult.php:99
ORMResult\current
current()
Definition: ORMResult.php:88
table
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global then executing the whole list after the page is displayed We don t do anything smart like collating updates to the same table or such because the list is almost always going to have just one item on if so it s not worth the trouble Since there is a job queue in the jobs table
Definition: deferred.txt:11
ORMResult\$current
IORMRow $current
Definition: ORMResult.php:43
ORMResult\key
key()
Definition: ORMResult.php:95
ORMResult\valid
valid()
Definition: ORMResult.php:114
ORMIterator
Definition: ORMIterator.php:29
ORMResult\__construct
__construct(IORMTable $table, ResultWrapper $res)
Definition: ORMResult.php:53
ORMResult\rewind
rewind()
Definition: ORMResult.php:105
ORMResult\isEmpty
isEmpty()
Definition: ORMResult.php:81
ResultWrapper
Result wrapper for grabbing data queried by someone else.
Definition: DatabaseUtility.php:99