createdAt = new \DateTimeImmutable('now'); $this->createdBy = new NullAccount(); } /** * Add tag * * @param Tag $tag Tag * * @return void * * @since 1.0.0 */ public function addTag(Tag $tag) : void { $this->tags[] = $tag; } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'title' => $this->name, 'description' => $this->description, 'descriptionRaw' => $this->descriptionRaw, 'status' => $this->status, 'type' => $this->type, 'column' => $this->column, 'order' => $this->order, 'ref' => $this->ref, 'createdBy' => $this->createdBy, 'createdAt' => $this->createdAt, 'comments' => $this->commentList, 'media' => $this->files, ]; } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } /** * Create a task from a card * * @param Task $task Task to create the card from * * @return KanbanCard * * @since 1.0.0 */ public static function createFromTask(Task $task) : self { $card = new self(); $card->ref = $task->id; return $card; } use \Modules\Media\Models\MediaListTrait; }