Project
+ Inheritance diagram for Project:

Description

Public Properties

final const GET_ACTIVE = ['archived' => false]
 
final const GET_ARCHIVED = ['archived' => true]
 
final const LAYOUT_BOARD = 'board'
 
final const LAYOUT_CALENDAR = 'calendar'
 
final const LAYOUT_LIST = 'list'
 
final const LAYOUT_TIMELINE = 'timeline'
 
final const TYPE = 'project'
 
- Public Properties inherited from AbstractEntity
const TYPE = ''
 All entity classes must redeclare this to match their resource_type. More...
 

Protected Properties

final const DIR = 'projects'
 
const MAP
 
- 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

Job duplicate (string $name, array $include, Team $team=null, array $schedule=[])
 Duplicates the project. More...
 
magic string getColor ()
 
magic string getCreatedAt ()
 RFC3339x. More...
 
magic null Status getCurrentStatus ()
 
Section getDefaultSection ()
 
magic string getDefaultView ()
 See the layout constants. More...
 
magic null string getIcon ()
 read-only More...
 
Generator< SectiongetIterator (int $limit=PHP_INT_MAX)
 Iterates over sections. More...
 
magic string getModifiedAt ()
 RFC3339x. More...
 
magic string getName ()
 
magic string getNotes ()
 
magic null User getOwner ()
 
Section[] getSections (int $limit=PHP_INT_MAX)
 
Status[] getStatuses ()
 
TaskCounts getTaskCounts ()
 
Task[] getTasks (array $filter=Task::GET_INCOMPLETE)
 The project's tasks. More...
 
magic null Team getTeam ()
 
ProjectWebhook[] getWebhooks ()
 
magic Workspace getWorkspace ()
 
magic bool hasOwner ()
 
magic bool hasTeam ()
 
magic bool isArchived ()
 
magic bool isPublic ()
 
bool isTemplate ()
 
Section newSection ()
 Factory. More...
 
Status newStatus ()
 Factory. More...
 
Task newTask ()
 Factory. More...
 
ProjectWebhook newWebhook ()
 Factory. More...
 
magic Section[] selectSections (callable $filter)
 fn( Section $section ): bool More...
 
magic Status[] selectStatuses (callable $filter)
 fn( Status $status ): bool More...
 
magic Task[] selectTasks (callable $filter, array $apiFilter=Task::GET_INCOMPLETE)
 fn( Task $task ): bool More...
 
magic $this setArchived (bool $archived)
 
magic $this setColor (string $color)
 
magic $this setDefaultView (string $layout)
 See the layout constants. More...
 
magic $this setName (string $name)
 
magic $this setNotes (string $notes)
 
magic $this setOwner (?User $owner)
 
magic $this setPublic (bool $public)
 
magic $this setTeam (?Team $team)
 
magic $this setWorkspace (Workspace $workspace)
 
- 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 CreateTrait
$this create ()
 Creates the new entity in Asana. More...
 
- Public Methods inherited from UpdateTrait
$this update ()
 PUT the data diff to Asana, if there is one. 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 FieldSettingsTrait
CustomField[] getCustomFields ()
 
magic CustomField[] getCustomFieldSettings ()
 
magic CustomField[] selectCustomFields (callable $filter)
 fn( CustomField $field ): bool More...
 
- Public Methods inherited from MembersTrait
$this addMember (User $user)
 
$this addMembers (array $users)
 
magic User[] getMembers ()
 
magic bool hasMembers ()
 
$this removeMember (User $user)
 
$this removeMembers (array $users)
 
magic User[] selectMembers (callable $filter)
 fn( User $user ): bool 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:
= [
'current_status' => Status::class,
'custom_field_settings' => [FieldSetting::class],
'followers' => [User::class],
'members' => [User::class],
'owner' => User::class,
'team' => Team::class,
'workspace' => Workspace::class
]

Methods

◆ _getParentNode()

null _getParentNode ( )
finalprotected
Returns
null

Reimplemented from CreateTrait.

◆ _setData()

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

Reimplemented from AbstractEntity.

◆ duplicate()

Job duplicate ( string  $name,
array  $include,
Team  $team = null,
array  $schedule = [] 
)

Duplicates the project.

See also
https://developers.asana.com/docs/duplicate-a-project

If $team is null, the duplicate will inherit the existing team.

If $schedule is given:

  • It must have either due_on or start_on
  • task_dates is automatically added to $include
  • should_skip_weekends defaults to true if not given.
Parameters
string$name
string[]$include
null | Team$team
array$schedule
Returns
Job

◆ getColor()

magic string getColor ( )
Returns
string

◆ getCreatedAt()

magic string getCreatedAt ( )

RFC3339x.

Returns
string

◆ getCurrentStatus()

magic null Status getCurrentStatus ( )
Returns
null|Status

◆ getDefaultSection()

Section getDefaultSection ( )
Returns
Section

◆ getDefaultView()

magic string getDefaultView ( )

See the layout constants.

Returns
string

◆ getIcon()

magic null string getIcon ( )

read-only

Returns
null|string

◆ getIterator()

Generator<Section> getIterator ( int  $limit = PHP_INT_MAX)

Iterates over sections.

See also
https://developers.asana.com/docs/get-sections-in-a-project
Parameters
int$limit
Returns
Generator<Section>

◆ getModifiedAt()

magic string getModifiedAt ( )

RFC3339x.

Returns
string

◆ getName()

magic string getName ( )
Returns
string

◆ getNotes()

magic string getNotes ( )
Returns
string

◆ getOwner()

magic null User getOwner ( )
Returns
null|User

◆ getSections()

Section [] getSections ( int  $limit = PHP_INT_MAX)
Parameters
int$limit
Returns
Section[]

◆ getStatuses()

Status [] getStatuses ( )
Returns
Status[]

◆ getTaskCounts()

TaskCounts getTaskCounts ( )
Returns
TaskCounts

◆ getTasks()

Task [] getTasks ( array  $filter = Task::GET_INCOMPLETE)

The project's tasks.

Parameters
array$filter
Returns
Task[]

◆ getTeam()

magic null Team getTeam ( )
Returns
null|Team

◆ getWebhooks()

ProjectWebhook [] getWebhooks ( )
Returns
ProjectWebhook[]

◆ getWorkspace()

magic Workspace getWorkspace ( )
Returns
Workspace

◆ hasOwner()

magic bool hasOwner ( )
Returns
bool

◆ hasTeam()

magic bool hasTeam ( )
Returns
bool

◆ isArchived()

magic bool isArchived ( )
Returns
bool

◆ isPublic()

magic bool isPublic ( )
Returns
bool

◆ isTemplate()

bool isTemplate ( )
final
Returns
bool

◆ newSection()

Section newSection ( )

Factory.

Returns
Section

◆ newStatus()

Status newStatus ( )

Factory.

Returns
Status

◆ newTask()

Task newTask ( )

Factory.

Returns
Task

◆ newWebhook()

ProjectWebhook newWebhook ( )

Factory.

Returns
ProjectWebhook

◆ selectSections()

magic Section [] selectSections ( callable  $filter)

fn( Section $section ): bool

Returns
Section[]

◆ selectStatuses()

magic Status [] selectStatuses ( callable  $filter)

fn( Status $status ): bool

Returns
Status[]

◆ selectTasks()

magic Task [] selectTasks ( callable  $filter,
array  $apiFilter = Task::GET_INCOMPLETE 
)

fn( Task $task ): bool

Returns
Task[]

◆ setArchived()

magic $this setArchived ( bool  $archived)
Returns
$this

◆ setColor()

magic $this setColor ( string  $color)
Returns
$this

◆ setDefaultView()

magic $this setDefaultView ( string  $layout)

See the layout constants.

Returns
$this

◆ setName()

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

◆ setNotes()

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

◆ setOwner()

magic $this setOwner ( ?User  $owner)
Returns
$this

◆ setPublic()

magic $this setPublic ( bool  $public)
Returns
$this

◆ setTeam()

magic $this setTeam ( ?Team  $team)
Depends:
create-only
Returns
$this

◆ setWorkspace()

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