add element child list
This commit is contained in:
parent
aa746fe3f0
commit
7350d747f3
9 changed files with 186 additions and 10 deletions
|
|
@ -17,7 +17,7 @@ class ElementController
|
|||
public function show(?int $id): JsonResponse
|
||||
{
|
||||
try {
|
||||
$element = $this->getElement->execute(
|
||||
$result = $this->getElement->execute(
|
||||
new GetElementRequest(id: $id)
|
||||
);
|
||||
} catch (BadRequestException $exception) {
|
||||
|
|
@ -30,7 +30,17 @@ class ElementController
|
|||
], 404);
|
||||
}
|
||||
|
||||
$element = $result->getElement();
|
||||
$childElements = [];
|
||||
foreach ($result->getChildElements() as $childElement) {
|
||||
$childElements[] = [
|
||||
'id' => $childElement->getId(),
|
||||
'title' => $childElement->getTitle(),
|
||||
];
|
||||
}
|
||||
|
||||
return new JsonResponse([
|
||||
'childElements' => $childElements,
|
||||
'element' => [
|
||||
'id' => $element->getId(),
|
||||
'title' => $element->getTitle(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue