MediaWiki REL1_40
MediaWiki\Linker\LinkTargetStore Class Reference

Service for retrieving and storing link targets. More...

Inherits MediaWiki\Linker\LinkTargetLookup.

Collaboration diagram for MediaWiki\Linker\LinkTargetStore:

Public Member Functions

 acquireLinkTargetId (LinkTarget $linkTarget, IDatabase $dbw)
 Attempt to assign a link target ID to the given $linkTarget.
 
 clearClassCache ()
 
 getLinkTargetById (int $linkTargetId)
 Find a link target by $id.
 
 getLinkTargetId (LinkTarget $linkTarget)
 Return link target id if exists.
 
 newLinkTargetFromRow (stdClass $row)
 Instantiate a new LinkTarget object based on a $row from the linktarget table.Use this method when a linktarget row was already fetched from the DB via a join. This method just constructs a new instance and does not try fetching missing values from the DB again.
Parameters
stdClass$rowwith the following fields:
  • int lt_id
  • int lt_namespace
  • string lt_title
Returns
LinkTarget

 

Public Attributes

$this byIdCache = []
 
$this byTitleCache = []
 
$this wanObjectCache = $WanObjectCache
 

Detailed Description

Service for retrieving and storing link targets.

Since
1.38

Definition at line 37 of file LinkTargetStore.php.

Member Function Documentation

◆ acquireLinkTargetId()

MediaWiki\Linker\LinkTargetStore::acquireLinkTargetId ( LinkTarget $linkTarget,
IDatabase $dbw )

Attempt to assign a link target ID to the given $linkTarget.

If it is already assigned, return the existing ID.

Note
If called within a transaction, the returned ID might become invalid if the transaction is rolled back, so it should not be passed outside of the transaction context.
Parameters
LinkTarget$linkTarget
IDatabase$dbwThe database connection to acquire the ID from.
Returns
int linktarget ID greater then 0
Exceptions
RuntimeExceptionif no linktarget ID has been assigned to this $linkTarget

Implements MediaWiki\Linker\LinkTargetLookup.

Definition at line 142 of file LinkTargetStore.php.

◆ clearClassCache()

MediaWiki\Linker\LinkTargetStore::clearClassCache ( )

Definition at line 228 of file LinkTargetStore.php.

◆ getLinkTargetById()

MediaWiki\Linker\LinkTargetStore::getLinkTargetById ( int $linkTargetId)

Find a link target by $id.

Parameters
int$linkTargetId
Returns
LinkTarget|null Returns null if no link target with this $linkTargetId exists in the database.

Implements MediaWiki\Linker\LinkTargetLookup.

Definition at line 93 of file LinkTargetStore.php.

◆ getLinkTargetId()

MediaWiki\Linker\LinkTargetStore::getLinkTargetId ( LinkTarget $linkTarget)

Return link target id if exists.

Parameters
LinkTarget$linkTarget
Returns
int|null linktarget ID greater then 0, null if not found

Implements MediaWiki\Linker\LinkTargetLookup.

Definition at line 124 of file LinkTargetStore.php.

◆ newLinkTargetFromRow()

MediaWiki\Linker\LinkTargetStore::newLinkTargetFromRow ( stdClass $row)

Instantiate a new LinkTarget object based on a $row from the linktarget table.Use this method when a linktarget row was already fetched from the DB via a join. This method just constructs a new instance and does not try fetching missing values from the DB again.

Parameters
stdClass$rowwith the following fields:
  • int lt_id
  • int lt_namespace
  • string lt_title
Returns
LinkTarget

Implements MediaWiki\Linker\LinkTargetLookup.

Definition at line 74 of file LinkTargetStore.php.

Member Data Documentation

◆ byIdCache

$this MediaWiki\Linker\LinkTargetStore::byIdCache = []

Definition at line 67 of file LinkTargetStore.php.

◆ byTitleCache

$this MediaWiki\Linker\LinkTargetStore::byTitleCache = []

Definition at line 68 of file LinkTargetStore.php.

◆ wanObjectCache

$this MediaWiki\Linker\LinkTargetStore::wanObjectCache = $WanObjectCache

Definition at line 66 of file LinkTargetStore.php.


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