stockRepository = $stockRepositoryInterface; $this->stockIdResolver = $stockIdResolver; } /** * @inheritdoc */ public function execute(SalesChannelInterface $salesChannel): StockInterface { $stockId = $this->stockIdResolver->resolve( $salesChannel->getType(), $salesChannel->getCode() ); if (null === $stockId) { throw new NoSuchEntityException(__('No linked stock found')); } return $this->stockRepository->get($stockId); } }