Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
StockRepository.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
18 
23 {
27  private $commandSave;
28 
32  private $commandGet;
33 
37  private $commandDeleteById;
38 
42  private $commandGetList;
43 
50  public function __construct(
51  SaveInterface $commandSave,
52  GetInterface $commandGet,
53  DeleteByIdInterface $commandDeleteById,
54  GetListInterface $commandGetList
55  ) {
56  $this->commandSave = $commandSave;
57  $this->commandGet = $commandGet;
58  $this->commandDeleteById = $commandDeleteById;
59  $this->commandGetList = $commandGetList;
60  }
61 
65  public function save(StockInterface $stock): int
66  {
67  return $this->commandSave->execute($stock);
68  }
69 
73  public function get(int $stockId): StockInterface
74  {
75  return $this->commandGet->execute($stockId);
76  }
77 
81  public function deleteById(int $stockId): void
82  {
83  $this->commandDeleteById->execute($stockId);
84  }
85 
90  {
91  return $this->commandGetList->execute($searchCriteria);
92  }
93 }
__construct(SaveInterface $commandSave, GetInterface $commandGet, DeleteByIdInterface $commandDeleteById, GetListInterface $commandGetList)
$searchCriteria
getList(SearchCriteriaInterface $searchCriteria=null)
$stock