Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\Store\Sql\PropertyInfoTable Class Reference

Class PropertyInfoTable implements PropertyInfoStore on top of an SQL table. More...

+ Inheritance diagram for Wikibase\Lib\Store\Sql\PropertyInfoTable:
+ Collaboration diagram for Wikibase\Lib\Store\Sql\PropertyInfoTable:

Public Member Functions

 __construct (EntityIdComposer $entityIdComposer, RepoDomainDb $db, bool $allowWrites)
 
 getPropertyInfo (PropertyId $propertyId)
 
 getPropertyInfoForDataType ( $dataType)
 
 getAllPropertyInfo ()
 
 setPropertyInfo (NumericPropertyId $propertyId, array $info)
 
 removePropertyInfo (NumericPropertyId $propertyId)
 
 getDomainDb ()
 Returns a database wrapper suitable for working with the database that contains the property info table. More...
 
 getTableName ()
 Returns the (logical) name of the database table that contains the property info. More...
 

Private Member Functions

 decodeBlob ( $blob)
 Decodes an info blob. More...
 
 decodeResult (IResultWrapper $res)
 Decodes a result with info blobs. More...
 
 assertCanWritePropertyInfo ()
 
 getWriteConnection ()
 
 getReadConnection ()
 

Private Attributes

 $entityIdComposer
 
 $db
 
 $tableName
 
 $allowWrites
 

Additional Inherited Members

- Public Attributes inherited from Wikibase\Lib\Store\PropertyInfoLookup
const KEY_DATA_TYPE = 'type'
 Key to use in the info array for the property's data type ID. More...
 
const KEY_FORMATTER_URL = 'formatterURL'
 Key to use in the info array for the property's formatter URL. More...
 
- Public Attributes inherited from Wikibase\Lib\Store\PropertyInfoStore
const KEY_CANONICAL_URI = 'canonicalURI'
 Key to use in the info array for the property's canonical URI pattern. More...
 

Detailed Description

Class PropertyInfoTable implements PropertyInfoStore on top of an SQL table.

Author
Daniel Kinzler
Bene* < benes.nosp@m.tar..nosp@m.wikim.nosp@m.edia.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\Sql\PropertyInfoTable::__construct ( EntityIdComposer  $entityIdComposer,
RepoDomainDb  $db,
bool  $allowWrites 
)
Parameters
EntityIdComposer$entityIdComposer
RepoDomainDb$db
bool$allowWritesShould writes be allowed to the table? false in cases that a remote property source is being used.

TODO split this more cleanly into a lookup and a writer, and then $allowWrites would not be needed?

Member Function Documentation

◆ assertCanWritePropertyInfo()

Wikibase\Lib\Store\Sql\PropertyInfoTable::assertCanWritePropertyInfo ( )
private

◆ decodeBlob()

Wikibase\Lib\Store\Sql\PropertyInfoTable::decodeBlob (   $blob)
private

Decodes an info blob.

Parameters
string | null | bool$blob
Returns
array|null The decoded blob as an associative array, or null if the blob could not be decoded.

◆ decodeResult()

Wikibase\Lib\Store\Sql\PropertyInfoTable::decodeResult ( IResultWrapper  $res)
private

Decodes a result with info blobs.

Parameters
IResultWrapper$res
Returns
array[] The array of decoded blobs

◆ getAllPropertyInfo()

Wikibase\Lib\Store\Sql\PropertyInfoTable::getAllPropertyInfo ( )
See also
PropertyInfoLookup::getAllPropertyInfo
Returns
array[] Array containing serialized property IDs as keys and info arrays as values
Exceptions
DBError

Implements Wikibase\Lib\Store\PropertyInfoLookup.

◆ getDomainDb()

Wikibase\Lib\Store\Sql\PropertyInfoTable::getDomainDb ( )

Returns a database wrapper suitable for working with the database that contains the property info table.

This is for use by closely related classes that want to operate directly on the database table.

◆ getPropertyInfo()

Wikibase\Lib\Store\Sql\PropertyInfoTable::getPropertyInfo ( PropertyId  $propertyId)
See also
PropertyInfoLookup::getPropertyInfo
Parameters
PropertyId$propertyId
Returns
array|null
Exceptions
InvalidArgumentException
DBError

Implements Wikibase\Lib\Store\PropertyInfoLookup.

◆ getPropertyInfoForDataType()

Wikibase\Lib\Store\Sql\PropertyInfoTable::getPropertyInfoForDataType (   $dataType)
See also
PropertyInfoLookup::getPropertyInfoForDataType
Parameters
string$dataType
Returns
array[] Array containing serialized property IDs as keys and info arrays as values
Exceptions
DBError

Implements Wikibase\Lib\Store\PropertyInfoLookup.

◆ getReadConnection()

Wikibase\Lib\Store\Sql\PropertyInfoTable::getReadConnection ( )
private

◆ getTableName()

Wikibase\Lib\Store\Sql\PropertyInfoTable::getTableName ( )

Returns the (logical) name of the database table that contains the property info.

This is for use for closely related classes that want to operate directly on the database table.

Returns
string

◆ getWriteConnection()

Wikibase\Lib\Store\Sql\PropertyInfoTable::getWriteConnection ( )
private

◆ removePropertyInfo()

Wikibase\Lib\Store\Sql\PropertyInfoTable::removePropertyInfo ( NumericPropertyId  $propertyId)
See also
PropertyInfoStore::removePropertyInfo
Parameters
NumericPropertyId$propertyId
Exceptions
DBError
InvalidArgumentException
Returns
bool

Implements Wikibase\Lib\Store\PropertyInfoStore.

◆ setPropertyInfo()

Wikibase\Lib\Store\Sql\PropertyInfoTable::setPropertyInfo ( NumericPropertyId  $propertyId,
array  $info 
)
See also
PropertyInfoStore::setPropertyInfo
Parameters
NumericPropertyId$propertyId
array$info
Exceptions
DBError
InvalidArgumentException

Implements Wikibase\Lib\Store\PropertyInfoStore.

Member Data Documentation

◆ $allowWrites

Wikibase\Lib\Store\Sql\PropertyInfoTable::$allowWrites
private

◆ $db

Wikibase\Lib\Store\Sql\PropertyInfoTable::$db
private

◆ $entityIdComposer

Wikibase\Lib\Store\Sql\PropertyInfoTable::$entityIdComposer
private

◆ $tableName

Wikibase\Lib\Store\Sql\PropertyInfoTable::$tableName
private

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