start = new \DateTime('now'); $this->end = (new \DateTime('now'))->modify('+1 month'); $this->calendar = new Calendar(); $this->actualCosts = new FloatInt(); $this->actualEarnings = new FloatInt(); $this->budgetCosts = new FloatInt(); $this->budgetEarnings = new FloatInt(); $this->createdAt = new \DateTimeImmutable('now'); $this->createdBy = new NullAccount(); $this->name = $name; } /** * Get progress type. * * @return int * * @since 1.0.0 */ public function getProgressType() : int { return $this->progressType; } /** * Set progress type. * * @param int $type Progress type * * @return void * * @since 1.0.0 */ public function setProgressType(int $type) : void { $this->progressType = $type; } /** * Add account relation * * @param AccountRelation $accRel Account relation * * @return void * * @since 1.0.0 */ public function addAccount(AccountRelation $accRel) : void { $this->accountRelations[] = $accRel; } /** * Get relations to the promotions. * * This includes customers, partners, ... * * @return array * * @since 1.0.0 */ public function getRelations() : array { return $this->accountRelations; } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'start' => $this->start, 'end' => $this->end, 'name' => $this->name, 'description' => $this->description, 'calendar' => $this->calendar, 'budgetCosts' => $this->budgetCosts, 'budgetEarnings' => $this->budgetEarnings, 'actualCosts' => $this->actualCosts, 'actualEarnings' => $this->actualEarnings, 'tasks' => $this->tasks, 'media' => $this->files, 'progress' => $this->progress, 'progressType' => $this->progressType, 'createdAt' => $this->createdAt, ]; } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } use \Modules\Media\Models\MediaListTrait; use \Modules\Attribute\Models\AttributeHolderTrait; }