parentElementId === null) { throw new BadRequestException('parentElementId is required'); } if ($request->title === null || $request->title === '') { throw new BadRequestException('title is required'); } $parentElement = $this->elementRepository->find( $request->parentElementId ); if ($parentElement === null) { throw new NotFoundException('Parent element not found'); } return $this->elementRepository->create(new CreateElementDto( set: $parentElement->getSet(), title: $request->title, description: '', iconImageUrl: null, richText: '', shortPdfPath: null, longPdfPath: null, youtubeUrl: null, parentElement: $parentElement, )); } }