Job
+ Inheritance diagram for Job:

Description

Public Properties

final const STATUS_ACTIVE = 'in_progress'
 
final const STATUS_FAIL = 'failed'
 
final const STATUS_QUEUED = 'not_started'
 
final const STATUS_SUCCESS = 'succeeded'
 
final const TYPE = 'job'
 
- Public Properties inherited from AbstractEntity
const TYPE = ''
 All entity classes must redeclare this to match their resource_type. More...
 

Protected Properties

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

magic null Project getNewProject ()
 
magic null Task getNewTask ()
 
magic string getResourceSubtype ()
 
magic string getStatus ()
 
bool isActive ()
 Whether the job is in progress. More...
 
bool isDone ()
 Whether the job has completed successfully or failed. More...
 
bool isFailed ()
 Whether the job failed. More...
 
bool isQueued ()
 Whether the job has yet to be started. More...
 
bool isSuccessful ()
 Whether the job completed successfully. More...
 
magic bool ofDuplicateProject ()
 
magic bool ofDuplicateTask ()
 
$this wait (callable $spinner=null)
 Sleeps a few seconds between reloads until the job completes successfully or fails. More...
 
- 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...
 

Additional Inherited Members

- 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...
 

Properties

◆ MAP

const MAP
protected
Initial value:
= [
'new_project' => Project::class,
'new_task' => Task::class
]

Methods

◆ getNewProject()

magic null Project getNewProject ( )
Returns
null|Project

◆ getNewTask()

magic null Task getNewTask ( )
Returns
null|Task

◆ getResourceSubtype()

magic string getResourceSubtype ( )
Returns
string

◆ getStatus()

magic string getStatus ( )
Returns
string

◆ isActive()

bool isActive ( )
final

Whether the job is in progress.

Returns
bool

◆ isDone()

bool isDone ( )
final

Whether the job has completed successfully or failed.

Returns
bool

◆ isFailed()

bool isFailed ( )
final

Whether the job failed.

Returns
bool

◆ isQueued()

bool isQueued ( )
final

Whether the job has yet to be started.

Returns
bool

◆ isSuccessful()

bool isSuccessful ( )
final

Whether the job completed successfully.

Returns
bool

◆ ofDuplicateProject()

magic bool ofDuplicateProject ( )
Returns
bool

◆ ofDuplicateTask()

magic bool ofDuplicateTask ( )
Returns
bool

◆ wait()

$this wait ( callable  $spinner = null)

Sleeps a few seconds between reloads until the job completes successfully or fails.

A spinner can be called every sleep cycle to indicate progress.

Parameters
null | callable$spinnerfn( Job $this ): void
Returns
$this