WorkItem
extends WorkItem
in package
Single work item on a work sheet.
A WorkList is a job and a WorkSheet is a work sheet inside a job. The parent of a work
item is the WorkSheet, not the WorkList.
Only the server computes price, in beforeSave (manual_price ?? round(hourlyRate × actualHours, 2)).
hourlyRate is a snapshot of the rate at creation (service, then company default) and stays
editable afterwards.
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_company_work_items'
- #[TableAlias]
- 'workItem'
Table of Contents
Properties
- $actualHours : string|null
- $billable : bool
- $companyServiceId : int|null
- $deleted : bool
- $description : string|null
- $estimatedHours : string|null
- $hourlyRate : string|null
- $id : int|null
- $insertDatetime : DateTime
- $manualPrice : string|null
- $order : int
- $price : string|null
- $status : WorkItemStatus
- $supplyKindId : int|null
- $title : string
- $updateDatetime : DateTime|null
- $vatPercents : numeric-string|null
- $workDate : DateTime|null
- $workSheetId : int
- IMPORTANT: membership of a sheet is not an ordinary field, it is a billing assignment.
Methods
- __construct() : mixed
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- getActualHours() : string|null
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getBillable() : bool
- getCompanyServiceId() : int|null
- getDeleted() : bool
- getDescription() : string|null
- getEstimatedHours() : string|null
- getHourlyRate() : string|null
- getId() : int|null
- getInsertDatetime() : DateTime
- getManualPrice() : string|null
- getOrder() : int
- getPrice() : string|null
- getStatus() : WorkItemStatus
- getSupplyKindId() : int|null
- getTitle() : string
- getUpdateDatetime() : DateTime|null
- getVatPercents() : numeric-string|null
- getWorkDate() : DateTime|null
- getWorkSheetId() : int
- isBillable() : bool
- isDeleted() : bool
- isPersisted() : bool
- setActualHours() : $this
- setBillable() : $this
- setCompanyServiceId() : $this
- setDeleted() : $this
- setDescription() : $this
- setEstimatedHours() : $this
- setHourlyRate() : $this
- setId() : $this
- setInsertDatetime() : $this
- setManualPrice() : $this
- setOrder() : $this
- setPrice() : $this
- setStatus() : $this
- setSupplyKindId() : $this
- setTitle() : $this
- setUpdateDatetime() : $this
- setVatPercents() : $this
- setWorkDate() : $this
- setWorkSheetId() : $this
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$actualHours
protected
string|null
$actualHours
= null
Attributes
- #[Column]
- $name: 'actual_hours'
- $type: 'decimal'
- $precision: 6
- $scale: 2
- $nullable: true
$billable
protected
bool
$billable
= true
Attributes
- #[Column]
- $name: 'billable'
- $type: 'boolean'
$companyServiceId
protected
int|null
$companyServiceId
= null
Attributes
- #[Column]
- $name: 'company_service_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- $nullable: true
$deleted
protected
bool
$deleted
= false
Attributes
- #[Column]
- $name: 'deleted'
- $type: 'boolean'
$description
protected
string|null
$description
= null
Attributes
- #[Column]
- $name: 'description'
- $type: 'text'
- $nullable: true
$estimatedHours
protected
string|null
$estimatedHours
= null
Attributes
- #[Column]
- $name: 'estimated_hours'
- $type: 'decimal'
- $precision: 6
- $scale: 2
- $nullable: true
$hourlyRate
protected
string|null
$hourlyRate
= null
Attributes
- #[Column]
- $name: 'hourly_rate'
- $type: 'decimal'
- $precision: 10
- $scale: 2
- $nullable: true
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'work_item_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$insertDatetime
protected
DateTime
$insertDatetime
= new DateTime()
Attributes
- #[Column]
- $name: 'insert_datetime'
- $type: 'datetime'
$manualPrice
protected
string|null
$manualPrice
= null
Attributes
- #[Column]
- $name: 'manual_price'
- $type: 'decimal'
- $precision: 10
- $scale: 2
- $nullable: true
$order
protected
int
$order
= 0
Attributes
- #[Column]
- $name: '`order`'
- $type: 'integer'
- $options: ['unsigned' => true, 'default' => 0]
$price
protected
string|null
$price
= null
Attributes
- #[Column]
- $name: 'price'
- $type: 'decimal'
- $precision: 10
- $scale: 2
- $nullable: true
$status
protected
WorkItemStatus
$status
= WorkItemStatus::New
Attributes
- #[Column]
- $name: 'status'
- $type: 'string'
- $length: 16
- $enumType: WorkItemStatus::class
$supplyKindId
protected
int|null
$supplyKindId
= null
Attributes
- #[Column]
- $name: 'supply_kind_id'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$title
protected
string
$title
= ''
Attributes
- #[Column]
- $name: 'title'
- $type: 'string'
- $length: 255
$updateDatetime
protected
DateTime|null
$updateDatetime
= null
Attributes
- #[Column]
- $name: 'update_datetime'
- $type: 'datetime'
- $nullable: true
$vatPercents
protected
numeric-string|null
$vatPercents
= null
Attributes
- #[Column]
- $name: 'vat_percents'
- $type: 'decimal'
- $precision: 5
- $scale: 2
- $nullable: true
$workDate
protected
DateTime|null
$workDate
= null
Attributes
- #[Column]
- $name: 'work_date'
- $type: 'date'
- $nullable: true
$workSheetId
IMPORTANT: membership of a sheet is not an ordinary field, it is a billing assignment.
protected
int
$workSheetId
= 0
An external client must not change it: moving work between sheets could take hours out
of an already invoiced sheet (making them billable again) or hand them to another client.
Stripping on the external path is the first defense; the second are the guards in
WorkItemManager::beforeSave() and
updateColumns(), which check both ends of the move and that company and client match.
The internal path (admin bridge, carry-over on closing) passes through them and the
attribute does not restrict it.
Attributes
- #[Column]
- $name: 'work_sheet_id'
- $type: 'integer'
- $options: ['unsigned' => true]
Methods
__construct()
public
__construct([int|null $id = null ][, int $workSheetId = 0 ][, int|null $companyServiceId = null ][, string $title = '' ][, string|null $description = null ][, WorkItemStatus $status = WorkItemStatus::New ][, DateTime|null $workDate = null ][, string|null $estimatedHours = null ][, string|null $actualHours = null ][, string|null $hourlyRate = null ][, string|null $manualPrice = null ][, string|null $vatPercents = null ][, bool $billable = true ][, string|null $price = null ][, int $order = 0 ][, DateTime $insertDatetime = new DateTime() ][, DateTime|null $updateDatetime = null ][, bool $deleted = false ][, int|null $supplyKindId = null ]) : mixed
Parameters
- $id : int|null = null
- $workSheetId : int = 0
- $companyServiceId : int|null = null
- $title : string = ''
- $description : string|null = null
- $status : WorkItemStatus = WorkItemStatus::New
- $workDate : DateTime|null = null
- $estimatedHours : string|null = null
- $actualHours : string|null = null
- $hourlyRate : string|null = null
- $manualPrice : string|null = null
- $vatPercents : string|null = null
- $billable : bool = true
- $price : string|null = null
- $order : int = 0
- $insertDatetime : DateTime = new DateTime()
- $updateDatetime : DateTime|null = null
- $deleted : bool = false
- $supplyKindId : int|null = null
callInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
getActualHours()
public
getActualHours() : string|null
Return values
string|nullgetAllTraits()
Returns all traits the class uses, including those used by parent classes and nested traits.
public
getAllTraits() : array<string, string>
Return values
array<string, string>getBillable()
public
getBillable() : bool
Return values
boolgetCompanyServiceId()
public
getCompanyServiceId() : int|null
Return values
int|nullgetDeleted()
public
getDeleted() : bool
Return values
boolgetDescription()
public
getDescription() : string|null
Return values
string|nullgetEstimatedHours()
public
getEstimatedHours() : string|null
Return values
string|nullgetHourlyRate()
public
getHourlyRate() : string|null
Return values
string|nullgetId()
public
getId() : int|null
Return values
int|nullgetInsertDatetime()
public
getInsertDatetime() : DateTime
Return values
DateTimegetManualPrice()
public
getManualPrice() : string|null
Return values
string|nullgetOrder()
public
getOrder() : int
Return values
intgetPrice()
public
getPrice() : string|null
Return values
string|nullgetStatus()
public
getStatus() : WorkItemStatus
Return values
WorkItemStatusgetSupplyKindId()
public
getSupplyKindId() : int|null
Return values
int|nullgetTitle()
public
getTitle() : string
Return values
stringgetUpdateDatetime()
public
getUpdateDatetime() : DateTime|null
Return values
DateTime|nullgetVatPercents()
public
getVatPercents() : numeric-string|null
Return values
numeric-string|nullgetWorkDate()
public
getWorkDate() : DateTime|null
Return values
DateTime|nullgetWorkSheetId()
public
getWorkSheetId() : int
Return values
intisBillable()
public
isBillable() : bool
Return values
boolisDeleted()
public
isDeleted() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolsetActualHours()
public
setActualHours(string|null $actualHours) : $this
Parameters
- $actualHours : string|null
Return values
$thissetBillable()
public
setBillable(bool $billable) : $this
Parameters
- $billable : bool
Return values
$thissetCompanyServiceId()
public
setCompanyServiceId(int|null $companyServiceId) : $this
Parameters
- $companyServiceId : int|null
Return values
$thissetDeleted()
public
setDeleted(bool $deleted) : $this
Parameters
- $deleted : bool
Return values
$thissetDescription()
public
setDescription(string|null $description) : $this
Parameters
- $description : string|null
Return values
$thissetEstimatedHours()
public
setEstimatedHours(string|null $estimatedHours) : $this
Parameters
- $estimatedHours : string|null
Return values
$thissetHourlyRate()
public
setHourlyRate(string|null $hourlyRate) : $this
Parameters
- $hourlyRate : string|null
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetInsertDatetime()
public
setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
- $insertDatetime : DateTime
Return values
$thissetManualPrice()
public
setManualPrice(string|null $manualPrice) : $this
Parameters
- $manualPrice : string|null
Return values
$thissetOrder()
public
setOrder(int $order) : $this
Parameters
- $order : int
Return values
$thissetPrice()
public
setPrice(string|null $price) : $this
Parameters
- $price : string|null
Return values
$thissetStatus()
public
setStatus(WorkItemStatus $status) : $this
Parameters
- $status : WorkItemStatus
Return values
$thissetSupplyKindId()
public
setSupplyKindId(int|null $supplyKindId) : $this
Parameters
- $supplyKindId : int|null
Return values
$thissetTitle()
public
setTitle(string $title) : $this
Parameters
- $title : string
Return values
$thissetUpdateDatetime()
public
setUpdateDatetime(DateTime|null $updateDatetime) : $this
Parameters
- $updateDatetime : DateTime|null
Return values
$thissetVatPercents()
public
setVatPercents(int|float|string|null $vatPercents) : $this
Parameters
- $vatPercents : int|float|string|null
Return values
$thissetWorkDate()
public
setWorkDate(DateTime|null $workDate) : $this
Parameters
- $workDate : DateTime|null
Return values
$thissetWorkSheetId()
public
setWorkSheetId(int $workSheetId) : $this
Parameters
- $workSheetId : int
Return values
$thisgetTraitsRecursive()
Walks the trait list recursively and collects nested traits too.
private
static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
- $traits : array<string, string>