Task
+ Inheritance diagram for Task:

Description

Public Properties

final const ASSIGN_INBOX = 'inbox'
 
final const ASSIGN_LATER = 'later'
 
final const ASSIGN_NEW = 'new'
 
final const ASSIGN_TODAY = 'today'
 
final const ASSIGN_UPCOMING = 'upcoming'
 
final const GET_INCOMPLETE = ['completed_since' => 'now']
 
final const TYPE = 'task'
 
- Public Properties inherited from AbstractEntity
const TYPE = ''
 All entity classes must redeclare this to match their resource_type. More...
 

Protected Properties

final const DIR = 'tasks'
 
const MAP
 
const OPT_FIELDS
 
- Protected Properties inherited from AbstractEntity
const DIR = ''
 All entity classes must redeclare this to match their REST directory. More...
 
const OPT_FIELDS = []
 
- Protected Properties inherited from Data
readonly Api Api $api
 
array array self[] AbstractEntity[] $data = []
 
array bool[] $diff = []
 
const MAP = []
 

Public Methods

Attachment addAttachment (string $file)
 Uploads a file attachment. More...
 
$this addDependencies (array $tasks)
 Premium feature. More...
 
$this addDependency (Task $task)
 Premium feature. More...
 
$this addDependent (Task $task)
 Premium feature. More...
 
$this addDependents (array $tasks)
 Premium feature. More...
 
$this addTag (Tag $tag)
 Adds a tag. More...
 
$this addToProject ($target)
 Adds the task to a project. More...
 
$this addToProjects (iterable $targets)
 Adds the task to multiple projects. More...
 
$this create ()
 
Job duplicate (string $name, array $include)
 Duplicates the task. More...
 
$this follow ()
 Adds the API user as a follower. More...
 
magic null User getAssignee ()
 
magic string getAssigneeStatus ()
 
Attachment[] getAttachments ()
 Attached files. More...
 
Story[] getComments ()
 
magic string getCompletedAt ()
 RFC3339x. More...
 
magic string getCreatedAt ()
 RFC3339x. More...
 
magic null FieldEntries getCustomFields ()
 Premium feature. More...
 
Task[] getDependencies ()
 Premium feature. More...
 
Task[] getDependents ()
 Premium feature. More...
 
ExternalData getExternal ()
 A proxy to the task's "external data". More...
 
magic bool getIsRenderedAsSeparator ()
 
magic Membership[] getMemberships ()
 
magic string getModifiedAt ()
 RFC3339x. More...
 
magic string getName ()
 
magic string getNotes ()
 
magic int getNumSubtasks ()
 
magic null Task getParent ()
 
Project[] getProjects ()
 
magic string getResourceSubtype ()
 
Section[] getSections ()
 
Story[] getStories ()
 
Task[] getSubTasks ()
 
magic Tag[] getTags ()
 
TaskWebhook[] getWebhooks ()
 
magic Workspace getWorkspace ()
 
magic bool hasAssignee ()
 
magic bool hasCustomFields ()
 Premium feature. More...
 
magic bool hasMemberships ()
 
magic bool hasName ()
 
magic bool hasNotes ()
 
magic bool hasParent ()
 
magic bool hasTags ()
 
magic bool isCompleted ()
 
Story newComment ()
 Factory. More...
 
Task newSubTask ()
 Factory. More...
 
TaskWebhook newWebhook ()
 Factory. More...
 
magic bool ofMilestone ()
 
$this removeDependencies (array $tasks)
 Premium feature. More...
 
$this removeDependency (Task $task)
 Premium feature. More...
 
$this removeDependent (Task $task)
 Premium feature. More...
 
$this removeDependents (array $tasks)
 Premium feature. More...
 
$this removeFromProject (Project $project)
 Removes the task from a project. More...
 
$this removeFromProjects (iterable $projects)
 Removes the task from multiple projects. More...
 
$this removeTag (Tag $tag)
 Removes a tag. More...
 
magic Attachment[] selectAttachments (callable $filter)
 fn( Attachment $attachment): bool More...
 
magic Story[] selectComments (callable $filter)
 fn( Story $comment ): bool More...
 
magic Task[] selectDependencies (callable $filter)
 fn( Task $dependency ): bool More...
 
magic Task[] selectDependents (callable $filter)
 fn( Task $dependent ): bool More...
 
magic Membership[] selectMemberships (callable $filter)
 fn( Membership $membership ): bool More...
 
magic Project[] selectProjects (callable $filter)
 fn( Project $project ): bool More...
 
magic Story[] selectStories (callable $filter)
 fn( Story $story ): bool More...
 
magic Task[] selectSubTasks (callable $filter)
 fn( Task $subtask ): bool More...
 
magic Tag[] selectTags (callable $filter)
 fn( Tag $tag ): bool More...
 
magic $this setAssignee (?User $user)
 
magic $this setAssigneeStatus (string $status)
 
magic $this setCompleted (bool $completed)
 
magic $this setIsRenderedAsSeparator (bool $flag)
 
magic $this setName (string $name)
 
magic $this setNotes (string $notes)
 
$this setParent (?Task $parent)
 Makes the task a subtask of another. More...
 
magic $this setResourceSubtype (string $type)
 
magic $this setWorkspace (Workspace $workspace)
 
$this unfollow ()
 Removes the API user as a follower. More...
 
$this update ()
 
- Public Methods inherited from AbstractEntity
string __toString ()
 The entity's canonical REST path. More...
 
null string getGid ()
 
bool hasGid ()
 
$this reload ()
 Fully reloads the entity from Asana. More...
 
- 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 ImmutableArrayTrait
void offsetSet (mixed $offset, mixed $value)
 Throws unless overridden. More...
 
- Public Methods inherited from DeleteTrait
void delete ()
 Deletes the entity from Asana. More...
 
- Public Methods inherited from DateTimeTrait
null DateTimeInterface _getDateTime ()
 Returns a date-time field as an immutable object. More...
 
- Public Methods inherited from DueTrait
magic null string getDueOn ()
 Y-m-d More...
 
magic null string getStartOn ()
 Y-m-d More...
 
magic bool hasDueOn ()
 
magic bool hasStartOn ()
 
$this setDueOn ($date)
 
$this setStartOn ($date)
 
- Public Methods inherited from FollowersTrait
$this addFollower (User $user)
 
$this addFollowers (array $users)
 
magic User[] getFollowers ()
 
magic bool hasFollowers ()
 
$this removeFollower (User $user)
 
$this removeFollowers (array $users)
 
magic User[] selectFollowers (callable $filter)
 fn( User $user ): bool More...
 
- Public Methods inherited from LikesTrait
magic Like[] getLikes ()
 
magic int getNumLikes ()
 
magic bool hasLikes ()
 
magic bool isLiked ()
 Whether you like this. More...
 
magic Like[] selectLikes (callable $filter)
 fn( Like $like ): bool More...
 
magic $this setLiked (bool $liked)
 Sets whether you like this. More...
 
- Public Methods inherited from SyncTrait
Event[] getEvents (?string &$token)
 Polls for new events. More...
 
- Public Methods inherited from UrlTrait
string getUrl ()
 

Protected Methods

null _getParentNode ()
 
void _setData (array $data)
 
- Protected Methods inherited from AbstractEntity
mixed _get (string $field)
 Lazy-loads missing fields. More...
 
void _reload (string $field)
 
- Protected Methods inherited from Data
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...
 
- Protected Methods inherited from PostMutatorTrait
$this _addWithPost (string $addPath, array $postData, string $field, array $diff)
 For existing entities this adds references to other entities via the given POST path. More...
 
$this _removeWithPost (string $rmPath, array $postData, string $field, array|Closure $diff)
 For existing entities this removes references to other entities via the given POST path. More...
 

Properties

◆ MAP

const MAP
protected
Initial value:
= [
'assignee' => User::class,
'custom_fields' => FieldEntries::class,
'external' => ExternalData::class,
'followers' => [User::class],
'likes' => [Like::class],
'memberships' => [Membership::class],
'parent' => self::class,
'tags' => [Tag::class],
'workspace' => Workspace::class
]

◆ OPT_FIELDS

const OPT_FIELDS
protected
Initial value:
= [
'memberships' => 'memberships.(project|section)'
]

Methods

◆ _getParentNode()

null _getParentNode ( )
finalprotected
Returns
null

Reimplemented from CreateTrait.

◆ _setData()

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

Reimplemented from AbstractEntity.

◆ addAttachment()

Attachment addAttachment ( string  $file)

Uploads a file attachment.

Parameters
string$file
Returns
Attachment

◆ addDependencies()

$this addDependencies ( array  $tasks)

Premium feature.

Parameters
Task[]$tasks
Returns
$this

◆ addDependency()

$this addDependency ( Task  $task)

Premium feature.

Parameters
Task$task
Returns
$this

◆ addDependent()

$this addDependent ( Task  $task)

Premium feature.

Parameters
Task$task
Returns
$this

◆ addDependents()

$this addDependents ( array  $tasks)

Premium feature.

Parameters
Task[]$tasks
Returns
$this

◆ addTag()

$this addTag ( Tag  $tag)

Adds a tag.

See also
https://developers.asana.com/docs/add-a-tag-to-a-task
Parameters
Tag$tag
Returns
$this

◆ addToProject()

$this addToProject (   $target)

Adds the task to a project.

See also
https://developers.asana.com/docs/add-a-project-to-a-task
Project::newTask()
Section::newTask()
Parameters
Project | Section$target
Returns
$this

◆ addToProjects()

$this addToProjects ( iterable  $targets)

Adds the task to multiple projects.

Parameters
iterable | Project[] | Section[]$targets
Returns
$this

◆ create()

$this create ( )
Returns
$this

Reimplemented from CreateTrait.

◆ duplicate()

Job duplicate ( string  $name,
array  $include 
)

Duplicates the task.

See also
https://developers.asana.com/docs/duplicate-a-task
Parameters
string$name
string[]$include
Returns
Job

◆ follow()

$this follow ( )

Adds the API user as a follower.

Returns
$this

◆ getAssignee()

magic null User getAssignee ( )
Returns
null|User

◆ getAssigneeStatus()

magic string getAssigneeStatus ( )
Returns
string

◆ getAttachments()

Attachment [] getAttachments ( )

Attached files.

Returns
Attachment[]

◆ getComments()

Story [] getComments ( )
Returns
Story[]

◆ getCompletedAt()

magic string getCompletedAt ( )

RFC3339x.

Returns
string

◆ getCreatedAt()

magic string getCreatedAt ( )

RFC3339x.

Returns
string

◆ getCustomFields()

magic null FieldEntries getCustomFields ( )

Premium feature.

Returns
null|FieldEntries

◆ getDependencies()

Task [] getDependencies ( )

Premium feature.

Returns
Task[]

◆ getDependents()

Task [] getDependents ( )

Premium feature.

Returns
Task[]

◆ getExternal()

ExternalData getExternal ( )

A proxy to the task's "external data".

This always returns an instance, regardless of whether the task on Asana actually has external data.

Asana will delete the external data object if it's emptied, and fetching it via GET will then return null, so we coalesce.

Returns
ExternalData

◆ getIsRenderedAsSeparator()

magic bool getIsRenderedAsSeparator ( )
Returns
bool

◆ getMemberships()

magic Membership [] getMemberships ( )
Returns
Membership[]

◆ getModifiedAt()

magic string getModifiedAt ( )

RFC3339x.

Returns
string

◆ getName()

magic string getName ( )
Returns
string

◆ getNotes()

magic string getNotes ( )
Returns
string

◆ getNumSubtasks()

magic int getNumSubtasks ( )
Returns
int

◆ getParent()

magic null Task getParent ( )
Returns
null|Task

◆ getProjects()

Project [] getProjects ( )
Returns
Project[]

◆ getResourceSubtype()

magic string getResourceSubtype ( )
Returns
string

◆ getSections()

Section [] getSections ( )
Returns
Section[]

◆ getStories()

Story [] getStories ( )
Returns
Story[]

◆ getSubTasks()

Task [] getSubTasks ( )
Returns
Task[]

◆ getTags()

magic Tag [] getTags ( )
Returns
Tag[]

◆ getWebhooks()

TaskWebhook [] getWebhooks ( )
Returns
TaskWebhook[]

◆ getWorkspace()

magic Workspace getWorkspace ( )
Returns
Workspace

◆ hasAssignee()

magic bool hasAssignee ( )
Returns
bool

◆ hasCustomFields()

magic bool hasCustomFields ( )

Premium feature.

Returns
bool

◆ hasMemberships()

magic bool hasMemberships ( )
Returns
bool

◆ hasName()

magic bool hasName ( )
Returns
bool

◆ hasNotes()

magic bool hasNotes ( )
Returns
bool

◆ hasParent()

magic bool hasParent ( )
Returns
bool

◆ hasTags()

magic bool hasTags ( )
Returns
bool

◆ isCompleted()

magic bool isCompleted ( )
Returns
bool

◆ newComment()

Story newComment ( )

Factory.

Returns
Story

◆ newSubTask()

Task newSubTask ( )

Factory.

Returns
Task

◆ newWebhook()

TaskWebhook newWebhook ( )

Factory.

Returns
TaskWebhook

◆ ofMilestone()

magic bool ofMilestone ( )
Returns
bool

◆ removeDependencies()

$this removeDependencies ( array  $tasks)

Premium feature.

Parameters
Task[]$tasks
Returns
$this

◆ removeDependency()

$this removeDependency ( Task  $task)

Premium feature.

Parameters
Task$task
Returns
$this

◆ removeDependent()

$this removeDependent ( Task  $task)

Premium feature.

Parameters
Task$task
Returns
$this

◆ removeDependents()

$this removeDependents ( array  $tasks)

Premium feature.

Parameters
Task[]$tasks
Returns
$this

◆ removeFromProject()

$this removeFromProject ( Project  $project)

Removes the task from a project.

See also
https://developers.asana.com/docs/remove-a-project-from-a-task
Parameters
Project$project
Returns
$this

◆ removeFromProjects()

$this removeFromProjects ( iterable  $projects)

Removes the task from multiple projects.

Parameters
iterable | Project[]$projects
Returns
$this

◆ removeTag()

$this removeTag ( Tag  $tag)

Removes a tag.

See also
https://developers.asana.com/docs/remove-a-tag-from-a-task
Parameters
Tag$tag
Returns
$this

◆ selectAttachments()

magic Attachment [] selectAttachments ( callable  $filter)

fn( Attachment $attachment): bool

Returns
Attachment[]

◆ selectComments()

magic Story [] selectComments ( callable  $filter)

fn( Story $comment ): bool

Returns
Story[]

◆ selectDependencies()

magic Task [] selectDependencies ( callable  $filter)

fn( Task $dependency ): bool

Returns
Task[]

◆ selectDependents()

magic Task [] selectDependents ( callable  $filter)

fn( Task $dependent ): bool

Returns
Task[]

◆ selectMemberships()

magic Membership [] selectMemberships ( callable  $filter)

fn( Membership $membership ): bool

Returns
Membership[]

◆ selectProjects()

magic Project [] selectProjects ( callable  $filter)

fn( Project $project ): bool

Returns
Project[]

◆ selectStories()

magic Story [] selectStories ( callable  $filter)

fn( Story $story ): bool

Returns
Story[]

◆ selectSubTasks()

magic Task [] selectSubTasks ( callable  $filter)

fn( Task $subtask ): bool

Returns
Task[]

◆ selectTags()

magic Tag [] selectTags ( callable  $filter)

fn( Tag $tag ): bool

Returns
Tag[]

◆ setAssignee()

magic $this setAssignee ( ?User  $user)
Returns
$this

◆ setAssigneeStatus()

magic $this setAssigneeStatus ( string  $status)
Returns
$this

◆ setCompleted()

magic $this setCompleted ( bool  $completed)
Returns
$this

◆ setIsRenderedAsSeparator()

magic $this setIsRenderedAsSeparator ( bool  $flag)
Returns
$this

◆ setName()

magic $this setName ( string  $name)
Returns
$this

◆ setNotes()

magic $this setNotes ( string  $notes)
Returns
$this

◆ setParent()

$this setParent ( ?Task  $parent)
final

Makes the task a subtask of another.

See also
https://developers.asana.com/docs/set-the-parent-of-a-task
Parameters
null | Task$parent
Returns
$this

◆ setResourceSubtype()

magic $this setResourceSubtype ( string  $type)
Depends:
create-only
Returns
$this

◆ setWorkspace()

magic $this setWorkspace ( Workspace  $workspace)
Depends:
create-only
Returns
$this

◆ unfollow()

$this unfollow ( )

Removes the API user as a follower.

Returns
$this

◆ update()

$this update ( )
Returns
$this

Reimplemented from UpdateTrait.