Event
+ Inheritance diagram for Event:

Description

An event obtained via sync token or delivered to you via webhook.

Asana has a "feature" that squashes "duplicate" events into the oldest date, as well as removing events inbetween, effectively rewriting history.

As such, any particular sequence of events should not be greatly relied upon for continuity. Cached or already-pooled entities will be stale as well.

You should reload the resource and go off of that data instead.

See also
https://developers.asana.com/docs/get-events-on-a-resource
https://developers.asana.com/docs/event
Project::getEvents()
Task::getEvents()
Api::getWebhookEvent()
AbstractEntity::reload()

Public Properties

final const ACTION_ADDED = 'added'
 
final const ACTION_CHANGED = 'changed'
 
final const ACTION_DELETED = 'deleted'
 
final const ACTION_REMOVED = 'removed'
 
final const ACTION_UNDELETED = 'undeleted'
 

Protected Properties

const GRAPH
 
const MAP
 
- Protected Properties inherited from Data
readonly Api Api $api
 
array array self[] AbstractEntity[] $data = []
 
array bool[] $diff = []
 
const MAP = []
 

Public Methods

magic string getAction ()
 The action-verb for the event. More...
 
magic null Change getChange ()
 The change made on the resource. More...
 
magic string getCreatedAt ()
 RFC3339x. More...
 
null array Project Section Task getParent ()
 The parent resource, if the event was relational. More...
 
array Attachment CustomField Like Project Section Story Tag Task User getResource ()
 The relational child, or the entity that was changed. More...
 
magic null User getUser ()
 The initiator, if there was one. More...
 
magic bool hasChange ()
 False if the event was relational. More...
 
magic bool hasParent ()
 True if the event was relational. More...
 
magic bool hasUser ()
 When false, Asana initiated the event. More...
 
bool wasAddition ()
 
bool wasChange ()
 
bool wasDeletion ()
 
bool wasRemoval ()
 
bool wasUndeletion ()
 
- Public Methods inherited from Data
mixed __call (string $method, array $args)
 Magic method handler. More...
 
 __construct (Api|self $caller, array $data=[])
 
array __serialize ()
 
void __unserialize (array $data)
 
bool isDiff ()
 Whether the instance has changes. More...
 
array jsonSerialize ()
 
bool offsetExists (mixed $offset)
 
mixed offsetGet (mixed $offset)
 
void offsetSet (mixed $offset, mixed $value)
 
void offsetUnset (mixed $offset)
 
array toArray (bool $diff=false)
 Dehydrated data. More...
 
- Public Methods inherited from DateTimeTrait
null DateTimeInterface _getDateTime ()
 Returns a date-time field as an immutable object. More...
 

Protected Methods

void _setData (array $data)
 
- Protected Methods inherited from Data
mixed _get (string $field)
 Magic method: getField() More...
 
bool _has (string $field)
 Magic method: hasField() More...
 
_hydrate (string $class, $item)
 Sub-data factory that draws from the entity pool. More...
 
bool _is (string $field)
 Magic method: isField() More...
 
bool _of (string $resourceSubtype)
 Magic method: ofResourceSubtypeValue() More...
 
array _select (string|iterable $subject, callable $filter,... $args)
 Magic method: selectField(callable $filter) More...
 
$this _set (string $field, $value)
 Magic method: setField(mixed $value) More...
 
void _setField (string $field, $value)
 Sets a value, hydrating if mapped, and clears the diff. More...
 

Properties

◆ GRAPH

const GRAPH
protected
Initial value:
= [
Attachment::TYPE => Attachment::class,
CustomField::TYPE => CustomField::class,
Like::TYPE => Like::class,
Project::TYPE => Project::class,
ProjectTemplate::TYPE => ProjectTemplate::class,
Section::TYPE => Section::class,
Story::TYPE => Story::class,
Tag::TYPE => Tag::class,
Task::TYPE => Task::class,
User::TYPE => User::class,
]

◆ MAP

const MAP
protected
Initial value:
= [
'change' => Change::class,
'user' => User::class
]

Methods

◆ _setData()

void _setData ( array  $data)
protected
Parameters
array$data
Returns
void

Reimplemented from Data.

◆ getAction()

magic string getAction ( )

The action-verb for the event.

Returns
string

◆ getChange()

magic null Change getChange ( )

The change made on the resource.

Returns
null|Change

◆ getCreatedAt()

magic string getCreatedAt ( )

RFC3339x.

Returns
string

◆ getParent()

null array Project Section Task getParent ( )

The parent resource, if the event was relational.

Returns
null|array|Project|Section|Task

◆ getResource()

The relational child, or the entity that was changed.

Returns
array|Attachment|CustomField|Like|Project|Section|Story|Tag|Task|User

◆ getUser()

magic null User getUser ( )

The initiator, if there was one.

Returns
null|User

◆ hasChange()

magic bool hasChange ( )

False if the event was relational.

Returns
bool

◆ hasParent()

magic bool hasParent ( )

True if the event was relational.

Returns
bool

◆ hasUser()

magic bool hasUser ( )

When false, Asana initiated the event.

("system")

Returns
bool

◆ wasAddition()

bool wasAddition ( )
final
Returns
bool

◆ wasChange()

bool wasChange ( )
final
Returns
bool

◆ wasDeletion()

bool wasDeletion ( )
final
Returns
bool

◆ wasRemoval()

bool wasRemoval ( )
final
Returns
bool

◆ wasUndeletion()

bool wasUndeletion ( )
final
Returns
bool