BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
BlueSpice\Entity Class Reference
Inheritance diagram for BlueSpice\Entity:
Collaboration diagram for BlueSpice\Entity:

Public Member Functions

 getConfig ()
 
 getTitle ()
 
 getTimestampTouched ()
 
 getTimestampCreated ()
 
 save (\User $oUser=null, $aOptions=[])
 
 delete (\User $oUser=null, $aOptions=[])
 
 getFullData ($aData=array())
 
 exists ()
 
 isArchived ()
 
 hasUnsavedChanges ()
 
 getID ()
 
 getOwnerID ()
 
 getType ()
 
 setUnsavedChanges ($bStatus=true)
 
 setOwnerID ($iOwnerID)
 
 toJson ()
 
 jsonSerialize ()
 
 setValuesByObject (\stdClass $oData)
 
 userIsOwner (\User $oUser)
 
 invalidateCache ()
 

Static Public Member Functions

static newFromFactory (\stdClass $data, EntityConfig $oConfig, EntityFactory $entityFactory)
 
static newFromContent (EntityContent $sContent)
 
static newFromObject ($oObject)
 
static getTitleFor ($iID)
 
static newFromID ($iID, $bForceReload=false)
 
static newFromTitle (\Title $oTitle, $bForceReload=false)
 

Public Attributes

const NS = -1
 
const ATTR_TYPE = 'type'
 
const ATTR_ID = 'id'
 
const ATTR_OWNER_ID = 'ownerid'
 
const ATTR_ARCHIVED = 'archived'
 
const ATTR_PARENT_ID = 'parentid'
 
const ATTR_TIMESTAMP_CREATED = 'timestampcreated'
 
const ATTR_TIMESTAMP_TOUCHED = 'timestamptouched'
 

Protected Member Functions

 __construct (\stdClass $oStdClass, EntityConfig $oConfig, EntityFactory $entityFactory=null)
 
 invalidateTitleCache ($purgeTime=null)
 

Protected Attributes

 $entityFactory = null
 
 $bUnsavedChanges = true
 
 $oConfig = null
 
 $iID = 0
 
 $iOwnerID = 0
 
 $sType = ''
 
 $bArchived = false
 

Member Function Documentation

BlueSpice\Entity::delete ( \User  $oUser = null,
  $aOptions = [] 
)

Archives the current Entity

Returns
BlueSpice\Entity::exists ( )

Checks, if the current Entity exists in the Wiki

Returns
boolean
BlueSpice\Entity::getConfig ( )

Gets the related config object

Returns
EntityConfig
BlueSpice\Entity::getFullData (   $aData = array())

Gets the Entity attributes formated for the api

Returns
array
BlueSpice\Entity::getID ( )

Returns the current id for the Entity

Returns
int
BlueSpice\Entity::getOwnerID ( )

Returns the current user id for the Entity

Returns
int
BlueSpice\Entity::getTitle ( )

Gets the related Title object

Returns
Title
static BlueSpice\Entity::getTitleFor (   $iID)
static

Gets the related Title object by ID

Returns
BlueSpice\Entity::getType ( )

Returns the current type for the BSSocialEntity

Returns
String
BlueSpice\Entity::hasUnsavedChanges ( )

Checks if there are unsaved changes

Returns
boolean
BlueSpice\Entity::invalidateCache ( )

Invalidated the cache

Returns
Entity
BlueSpice\Entity::invalidateTitleCache (   $purgeTime = null)
protected

Almost a copy of Title::invalidateCache method - but we need an immediate invalidation, not whenever the db feels 'idle' Updates page_touched for this page; called from LinksUpdate.php

Parameters
string$purgeTime[optional] TS_MW timestamp
Returns
bool True if the update succeeded
BlueSpice\Entity::isArchived ( )
Returns
boolean
BlueSpice\Entity::jsonSerialize ( )

Returns a json serializeable stdClass

Returns
stdClass

Implements JsonSerializable.

static BlueSpice\Entity::newFromContent ( EntityContent  $sContent)
static

Get Entity by EntityContent Object, wrapper for newFromObject

Deprecated:
since version 3.0.0 - Use mediawiki service ('BSEntityFactory')->newFromContent() instead
Parameters
EntityContent$sContent
Returns
Entity
static BlueSpice\Entity::newFromFactory ( \stdClass  $data,
EntityConfig  $oConfig,
EntityFactory  $entityFactory 
)
static

Returns the instance - Should not be used directly. This is a workaround as all entity __construc methods are private. Use mediawiki service 'BSEntityFactory' instead

Parameters
\stdClass$data
\BlueSpice\EntityConfig$oConfig
\BlueSpice\EntityFactory$entityFactory
Returns
static BlueSpice\Entity::newFromID (   $iID,
  $bForceReload = false 
)
static

Get Entity from ID, wrapper for newFromTitle

Deprecated:
since version 3.0.0 - Use mediawiki service ('BSEntityFactory')->newFromID() instead
Parameters
int$iID
boolean$bForceReload
Returns
Entity | null
static BlueSpice\Entity::newFromObject (   $oObject)
static

Get Entity by Json Object

Deprecated:
since version 3.0.0 - Use mediawiki service ('BSEntityFactory')->newFromObject() instead
Parameters
Object$oObject
Returns
Entity
static BlueSpice\Entity::newFromTitle ( \Title  $oTitle,
  $bForceReload = false 
)
static

Main method for getting a Entity from a Title

Deprecated:
since version 3.0.0 - Use mediawiki service ('BSEntityFactory')->newFromSourceTitle() instead
Parameters
\Title$oTitle
boolean$bForceReload
Returns
Entity
BlueSpice\Entity::save ( \User  $oUser = null,
  $aOptions = [] 
)

Saves the current Entity

Returns
BlueSpice\Entity::setOwnerID (   $iOwnerID)

Sets the current user ID

Parameters
int
Returns
Entity
BlueSpice\Entity::setUnsavedChanges (   $bStatus = true)

Sets the current Entity to an unsaved changes mode, refreshes cache

Parameters
String$bStatus
Returns
Entity
BlueSpice\Entity::setValuesByObject ( \stdClass  $oData)
Parameters
\stdClass$oData
BlueSpice\Entity::toJson ( )

Subclass needs to return the current Entity as a Json encoded string

Deprecated:
since 2.27.0 - Use json_encode( $oInstance ) instead
Returns
stdObject - Subclass needs to return encoded string!
BlueSpice\Entity::userIsOwner ( \User  $oUser)

Checks if the given User is the owner of this entity

Parameters
\User$oUser
Returns
boolean

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