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

Public Member Functions

 __sleep ()
 
 __wakeup ()
 
 __toString ()
 
 toDbArray ()
 
 isEnabledEvent ()
 
 loadFromRow ($row)
 
 loadFromID ($id, $fromMaster=false)
 
 serializeExtra ()
 
 isDismissable ($distribution)
 
 userCan ($field, User $user)
 
 getId ()
 
 getTimestamp ()
 
 getType ()
 
 getVariant ()
 
 getExtra ()
 
 getExtraParam ($key, $default=null)
 
 getAgent ()
 
 getTitle ($fromMaster=false)
 
 getRevision ()
 
 getCategory ()
 
 getSection ()
 
 getUseJobQueue ()
 
 setType ($type)
 
 setVariant ($variant)
 
 setAgent (User $agent)
 
 setTitle (Title $title)
 
 setExtra ($name, $value)
 
 getLinkMessage ($rank)
 
 getLinkDestination ($rank)
 
 getBundleHash ()
 
 setBundleHash ($hash)
 
 isDeleted ()
 
 setBundledEvents ($events)
 
 getBundledEvents ()
 
 canBeBundled ()
 
 getBundlingKey ()
 
 setBundledElements ($bundleables)
 
 getSortingKey ()
 
- Public Member Functions inherited from EchoAbstractEntity
 toDbArray ()
 

Static Public Member Functions

static create ($info=[])
 
static newFromRow ($row)
 
static newFromID ($id)
 

Protected Member Functions

 __construct ()
 
 insert ()
 

Static Protected Member Functions

static resolveTargetPages ($targetPageIds)
 

Protected Attributes

 $type = null
 
 $id = null
 
 $variant = null
 
 $agent = null
 
 $title = null
 
 $pageId = null
 
 $revision = null
 
 $extra = []
 
 $timestamp = null
 
 $bundleHash
 
 $bundledEvents
 
 $deleted = 0
 

Detailed Description

Immutable class to represent an event. In Echo nomenclature, an event is a single occurrence.

Constructor & Destructor Documentation

EchoEvent::__construct ( )
protected

You should not call the constructor. Instead use one of the factory functions: EchoEvent::create To create a new event EchoEvent::newFromRow To create an event object from a row object EchoEvent::newFromID To create an event object from the database given its ID

Member Function Documentation

EchoEvent::canBeBundled ( )

Implements Bundleable.

static EchoEvent::create (   $info = [])
static

Creates an EchoEvent object

Parameters
array$infoNamed arguments: type (required): The event type; variant: A variant of the type; agent: The user who caused the event; title: The page on which the event was triggered; extra: Event-specific extra information (e.g. post content)
Exceptions
MWException
Returns
EchoEvent|bool false if aborted via hook or Echo DB is read-only
EchoEvent::getAgent ( )
Returns
User|null
EchoEvent::getBundleHash ( )
Returns
string
EchoEvent::getBundlingKey ( )

Implements Bundleable.

EchoEvent::getCategory ( )

Get the category of the event type

Returns
string
EchoEvent::getExtra ( )
Returns
array|null
EchoEvent::getId ( )
Returns
int
EchoEvent::getLinkDestination (   $rank)

Get the link destination of the primary or secondary link for a notification type.

Parameters
String$rank'primary' or 'secondary'
Returns
String The link destination, e.g. 'agent'
EchoEvent::getLinkMessage (   $rank)

Get the message key of the primary or secondary link for a notification type.

Parameters
String$rank'primary' or 'secondary'
Returns
String i18n message key
EchoEvent::getRevision ( )
Returns
Revision|null
EchoEvent::getSection ( )

Get the section of the event type

Returns
string
EchoEvent::getSortingKey ( )

Implements Bundleable.

EchoEvent::getTimestamp ( )
Returns
string
EchoEvent::getTitle (   $fromMaster = false)
Parameters
bool$fromMaster
Returns
null|Title
EchoEvent::getType ( )
Returns
string
EchoEvent::getUseJobQueue ( )

Determine whether an event can use the job queue, or should be immediate

Returns
bool
EchoEvent::getVariant ( )
Returns
string|null
EchoEvent::insert ( )
protected

Inserts the object into the database.

EchoEvent::isDeleted ( )
Returns
bool
EchoEvent::isDismissable (   $distribution)

Check if the event is dismissable for the given distribution type

Parameters
string$distributionnotification distribution web/email
Returns
bool
EchoEvent::isEnabledEvent ( )

Check whether the echo event is an enabled event

Returns
bool
EchoEvent::loadFromID (   $id,
  $fromMaster = false 
)

Loads data from the database into this object, given the event ID.

Parameters
int$idEvent ID
bool$fromMaster
Returns
bool Whether it loaded successfully
EchoEvent::loadFromRow (   $row)

Loads data from the provided $row into this object.

Parameters
stdClass$rowrow object from echo_event
Returns
bool Whether loading was successful
static EchoEvent::newFromID (   $id)
static

Creates an EchoEvent from the database by ID

Parameters
int$idEvent ID
Returns
EchoEvent|bool
static EchoEvent::newFromRow (   $row)
static

Creates an EchoEvent from a row object

Parameters
stdClass$rowrow object from echo_event
Returns
EchoEvent|bool
static EchoEvent::resolveTargetPages (   $targetPageIds)
staticprotected
Parameters
int[]|int|false$targetPageIds
Returns
Title[]
EchoEvent::serializeExtra ( )

Serialize the extra data for event

Returns
string
EchoEvent::setBundledElements (   $bundleables)

Implements Bundleable.

EchoEvent::setBundleHash (   $hash)
Parameters
string$hash
EchoEvent::toDbArray ( )

Convert the object's database property to array

Returns
array
EchoEvent::userCan (   $field,
User  $user 
)

Determine if the current user is allowed to view a particular field of this revision, if it's marked as deleted. When no revision is attached always returns true.

Parameters
int$fieldOne of Revision::DELETED_TEXT, Revision::DELETED_COMMENT, Revision::DELETED_USER
User$userUser object to check
Returns
bool

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