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