Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
StockByWebsiteIdResolver.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
15 
20 {
24  private $websiteRepository;
25 
29  private $stockResolver;
30 
35  public function __construct(
36  WebsiteRepositoryInterface $websiteRepository,
37  StockResolverInterface $stockResolver
38  ) {
39  $this->websiteRepository = $websiteRepository;
40  $this->stockResolver = $stockResolver;
41  }
42 
46  public function execute(int $websiteId): StockInterface
47  {
48  $websiteCode = $this->websiteRepository->getById($websiteId)->getCode();
49 
50  return $this->stockResolver->execute(
53  );
54  }
55 }
__construct(WebsiteRepositoryInterface $websiteRepository, StockResolverInterface $stockResolver)
if(!isset($_GET['website_code'])) $websiteCode
Definition: website.php:11