date === null) { throw new BadRequestException('date is required'); } if ($request->planId === null) { throw new BadRequestException('planId is required'); } $id = $request->planId; $plan = $this->planRepo->find($id); if ($plan === null) { throw new DomainException("Plan with id: $id doesnt exist"); } return $this->scheduledNodeRepo->create( new CreateScheduledNodeDto( date: $request->date, plan: $plan, ) ); } }