Portfolio
+ Inheritance diagram for Portfolio:

Description

A portfolio.

Portfolios act like directories, they contain projects and other portfolios (non-circular).

See also
https://developers.asana.com/docs/asana-portfolios
https://developers.asana.com/docs/portfolio
Workspace::newPortfolio()

Public Properties

final const TYPE = 'portfolio'
 
- Public Properties inherited from AbstractEntity
const TYPE = ''
 All entity classes must redeclare this to match their resource_type. More...
 

Protected Properties

final const DIR = 'portfolios'
 
const GRAPH
 Any resource types that are not present here will fall back to becoming Data. More...
 
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

$this addItem (Portfolio|Project $item)
 
$this addItems (iterable $items)
 
magic string getColor ()
 
magic string getCreatedAt ()
 RFC3339x. More...
 
magic User getCreatedBy ()
 
Portfolio[] Project[] getItems ()
 
Generator< Portfolio|ProjectgetIterator ()
 No API filter is available. More...
 
magic string getName ()
 
magic User getOwner ()
 
Project[] getProjects ()
 
magic Workspace getWorkspace ()
 
Portfolio[] Project[] selectItems (callable $filter)
 
magic $this setColor (string $color)
 
magic $this setMembers (User[] $members)
 
magic $this setName (string $name)
 
magic $this setOwner (User $owner)
 
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 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 UrlTrait
string getUrl ()
 

Protected Methods

null _getParentNode ()
 
- Protected Methods inherited from AbstractEntity
mixed _get (string $field)
 Lazy-loads missing fields. More...
 
void _reload (string $field)
 
void _setData (array $data)
 
- 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

◆ GRAPH

const GRAPH
protected
Initial value:
= [
self::TYPE => self::class,
Project::TYPE => Project::class,
]

Any resource types that are not present here will fall back to becoming Data.

◆ MAP

const MAP
protected
Initial value:
= [
'created_by' => User::class,
'custom_field_settings' => [FieldSetting::class],
'owner' => User::class,
'members' => [User::class],
'workspace' => Workspace::class
]

Methods

◆ _getParentNode()

null _getParentNode ( )
finalprotected
Returns
null

Reimplemented from CreateTrait.

◆ addItem()

$this addItem ( Portfolio|Project  $item)

◆ addItems()

$this addItems ( iterable  $items)
Parameters
iterable<Portfolio|Project>$items
Returns
$this

◆ getColor()

magic string getColor ( )
Returns
string

◆ getCreatedAt()

magic string getCreatedAt ( )

RFC3339x.

Returns
string

◆ getCreatedBy()

magic User getCreatedBy ( )
Returns
User

◆ getItems()

Portfolio [] Project [] getItems ( )
Returns
Portfolio[]|Project[]

◆ getIterator()

Generator<Portfolio|Project> getIterator ( )

No API filter is available.

Returns
Generator<Portfolio|Project>

◆ getName()

magic string getName ( )
Returns
string

◆ getOwner()

magic User getOwner ( )
Returns
User

◆ getProjects()

Project [] getProjects ( )
Returns
Project[]

◆ getWorkspace()

magic Workspace getWorkspace ( )
Returns
Workspace

◆ selectItems()

Portfolio [] Project [] selectItems ( callable  $filter)
Parameters
callable$filter
Returns
Portfolio[]|Project[]

◆ setColor()

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

◆ setMembers()

magic $this setMembers ( User[]  $members)
Returns
$this

◆ setName()

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

◆ setOwner()

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

◆ setWorkspace()

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