Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup Class Reference

EntityLookup that counts how many entities have been loaded through it and throws an exception once to many entities have been loaded. More...

+ Inheritance diagram for Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup:
+ Collaboration diagram for Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup:

Public Member Functions

 __construct (EntityLookup $entityLookup, int $entityAccessLimit)
 
 getEntity (EntityId $entityId)
 
 hasEntity (EntityId $entityId)
 
 getEntityAccessCount ()
 Returns the number of entities already loaded via this object.
 
 reset ()
 Resets the list of entities loaded via this object.
 
 entityHasBeenAccessed (EntityId $entityId)
 Whether an entity has been accessed before via this RestrictedEntityLookup.
 

Private Attributes

EntityLookup $entityLookup
 
int $entityAccessLimit
 
array $entitiesAccessed = []
 

Detailed Description

EntityLookup that counts how many entities have been loaded through it and throws an exception once to many entities have been loaded.

This is needed to limit the number of entities that can be loaded via some user controlled features, like entity access in Lua.

Since
2.0
Author
Marius Hoch < hoo@o.nosp@m.nlin.nosp@m.e.de >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::__construct ( EntityLookup $entityLookup,
int $entityAccessLimit )

Member Function Documentation

◆ entityHasBeenAccessed()

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::entityHasBeenAccessed ( EntityId $entityId)

Whether an entity has been accessed before via this RestrictedEntityLookup.

Since
2.0

◆ getEntity()

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::getEntity ( EntityId $entityId)
See also
EntityLookup::getEntity
Parameters
EntityId$entityId
Exceptions
EntityAccessLimitException
Returns
EntityDocument

Implements Wikibase\DataModel\Services\Lookup\EntityLookup.

◆ getEntityAccessCount()

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::getEntityAccessCount ( )

Returns the number of entities already loaded via this object.

Since
2.0

◆ hasEntity()

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::hasEntity ( EntityId $entityId)
See also
EntityLookup::hasEntity
Exceptions
EntityLookupException

Implements Wikibase\DataModel\Services\Lookup\EntityLookup.

◆ reset()

Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::reset ( )

Resets the list of entities loaded via this object.

Since
3.4

Member Data Documentation

◆ $entitiesAccessed

array Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::$entitiesAccessed = []
private

◆ $entityAccessLimit

int Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::$entityAccessLimit
private

◆ $entityLookup

EntityLookup Wikibase\DataModel\Services\Lookup\RestrictedEntityLookup::$entityLookup
private

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