MediaWiki REL1_39
MediaWiki\Linker\LinkTargetLookup Interface Reference
Inheritance diagram for MediaWiki\Linker\LinkTargetLookup:

Public Member Functions

 acquireLinkTargetId (LinkTarget $linkTarget, IDatabase $dbw)
 Attempt to assign an link target ID to the given $linkTarget.
 
 getLinkTargetById (int $linkTargetId)
 Find an 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.
 

Detailed Description

Since
1.38

Definition at line 29 of file LinkTargetLookup.php.

Member Function Documentation

◆ acquireLinkTargetId()

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

Attempt to assign an 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

Implemented in MediaWiki\Linker\LinkTargetStore.

◆ getLinkTargetById()

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

Find an link target by $id.

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

Implemented in MediaWiki\Linker\LinkTargetStore.

◆ getLinkTargetId()

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

Return link target id if exists.

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

Implemented in MediaWiki\Linker\LinkTargetStore.

◆ newLinkTargetFromRow()

MediaWiki\Linker\LinkTargetLookup::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

Implemented in MediaWiki\Linker\LinkTargetStore.


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