Add serialization

This commit is contained in:
Dennis Eichhorn 2017-08-03 21:47:52 +02:00
parent a2a9f79a29
commit 7b8f246480
2 changed files with 22 additions and 2 deletions

View File

@ -191,9 +191,29 @@ class KanbanCard implements \JsonSerializable
public function jsonSerialize() : array
{
return [];
return [
'title' => $this->name,
'description' => $this->description,
'status' => $this->status,
'type' => $this->type,
'column' => $this->name,
'order' => $this->name,
'ref' => $this->name,
'createdBy' => $this->name,
'createdAt' => $this->name,
'labels' => $this->name,
'comments' => $this->name,
'media' => $this->name,
];
}
public static function createFromTask(Task $task) : KanbanCard
{
$card = new self();
$card->setRef($task->getId());
return $card;
}
/* todo: create function to create card from task etc... this fills the values here. what happens if task changes? bad idea! */
/* todo: maybe allow ref to be an object and datamapper creates that object? how does the datamapper know what kind of datamapper to use? Just assume it's called ObjectMapper? bad isn't it?! */
}

View File