MediaWiki master
MediaWiki\Watchlist\WatchlistLabelStore Class Reference

Service class for storage of watchlist labels. More...

Public Member Functions

 __construct (private IConnectionProvider $dbProvider, private LoggerInterface $logger, private Config $config)
 
 countAllForUser (UserIdentity $user)
 Get the current total count of a user's watchlist labels.
 
 countItems (array $labelIds)
 Get counts of all items with the given labels.
 
 delete (UserIdentity $user, array $ids)
 Delete a set of watchlist labels, by ID.
 
 loadAllForUser (UserIdentity $user)
 Get all of a user's watchlist labels.
 
 loadById (UserIdentity $user, int $id)
 Load a single watchlist label by ID.
 
 loadByName (UserIdentity $user, string $name)
 Load a single watchlist label by (normalized) name.
 
 save (WatchlistLabel $label)
 Save a watchlist label to the database.
 

Public Attributes

const TABLE_WATCHLIST_LABEL = 'watchlist_label'
 
const TABLE_WATCHLIST_LABEL_MEMBER = 'watchlist_label_member'
 

Detailed Description

Service class for storage of watchlist labels.

Since
1.46

Definition at line 18 of file WatchlistLabelStore.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Watchlist\WatchlistLabelStore::__construct ( private IConnectionProvider $dbProvider,
private LoggerInterface $logger,
private Config $config )

Definition at line 24 of file WatchlistLabelStore.php.

Member Function Documentation

◆ countAllForUser()

MediaWiki\Watchlist\WatchlistLabelStore::countAllForUser ( UserIdentity $user)

Get the current total count of a user's watchlist labels.

Parameters
UserIdentity$user
Returns
int

Definition at line 226 of file WatchlistLabelStore.php.

◆ countItems()

MediaWiki\Watchlist\WatchlistLabelStore::countItems ( array $labelIds)

Get counts of all items with the given labels.

Parameters
int[]$labelIds
Returns
array Keys are the label ID, values the integer count.

Definition at line 201 of file WatchlistLabelStore.php.

◆ delete()

MediaWiki\Watchlist\WatchlistLabelStore::delete ( UserIdentity $user,
array $ids )

Delete a set of watchlist labels, by ID.

Parameters
UserIdentity$user
int[]$idswatchlist_label IDs to delete.
Returns
bool True on success, false on failure.

Definition at line 87 of file WatchlistLabelStore.php.

◆ loadAllForUser()

MediaWiki\Watchlist\WatchlistLabelStore::loadAllForUser ( UserIdentity $user)

Get all of a user's watchlist labels.

Parameters
UserIdentity$user
Returns
WatchlistLabel[] Labels indexed by ID

Definition at line 172 of file WatchlistLabelStore.php.

Referenced by MediaWiki\Specials\SpecialWatchlist\__construct().

◆ loadById()

MediaWiki\Watchlist\WatchlistLabelStore::loadById ( UserIdentity $user,
int $id )

Load a single watchlist label by ID.

Parameters
UserIdentity$user
int$idThe watchlist_label ID.
Returns
?WatchlistLabel The label, or null if not found.

Definition at line 129 of file WatchlistLabelStore.php.

◆ loadByName()

MediaWiki\Watchlist\WatchlistLabelStore::loadByName ( UserIdentity $user,
string $name )

Load a single watchlist label by (normalized) name.

Parameters
UserIdentity$user
string$nameThe name to search for.
Returns
?WatchlistLabel The label, or null if not found.

Definition at line 150 of file WatchlistLabelStore.php.

◆ save()

MediaWiki\Watchlist\WatchlistLabelStore::save ( WatchlistLabel $label)

Save a watchlist label to the database.

If this results in a new row, the label's ID will be set.

Definition at line 35 of file WatchlistLabelStore.php.

References MediaWiki\Watchlist\WatchlistLabel\getId(), and MediaWiki\Watchlist\WatchlistLabel\getName().

Member Data Documentation

◆ TABLE_WATCHLIST_LABEL

const MediaWiki\Watchlist\WatchlistLabelStore::TABLE_WATCHLIST_LABEL = 'watchlist_label'

Definition at line 20 of file WatchlistLabelStore.php.

◆ TABLE_WATCHLIST_LABEL_MEMBER

const MediaWiki\Watchlist\WatchlistLabelStore::TABLE_WATCHLIST_LABEL_MEMBER = 'watchlist_label_member'

Definition at line 21 of file WatchlistLabelStore.php.


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