id === null) { throw new BadRequestException('setId is required'); } if ($request->name === null || trim($request->name) === '') { throw new BadRequestException('name is required'); } $set = $this->setRepository->find($request->id); if ($set === null) { throw new NotFoundException('Set not found'); } $set->setName(trim($request->name)); return $this->setRepository->update($set); } }