Add jsonSerialize method to RelationalEntity
Signed-off-by: Julius Haertl <jus@bitgrid.net>
This commit is contained in:
committed by
Julius Härtl
parent
3324556542
commit
34c1a681b1
@@ -45,20 +45,10 @@ class Stack extends RelationalEntity implements JsonSerializable {
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
if (!empty($this->cards)) {
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'order' => $this->order,
|
||||
'boardId' => $this->boardId,
|
||||
'cards' => $this->cards
|
||||
];
|
||||
$json = parent::jsonSerialize();
|
||||
if (empty($this->cards)) {
|
||||
unset($json['cards']);
|
||||
}
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'order' => $this->order,
|
||||
'boardId' => $this->boardId
|
||||
];
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user