1 | <?php |
||
29 | class StockReduceProcessor extends ItemHolderValidator implements PurchaseProcessor |
||
30 | { |
||
31 | /** |
||
32 | * @var ProductStockRepository |
||
33 | */ |
||
34 | protected $productStockRepository; |
||
35 | |||
36 | /** |
||
37 | * @var EntityManagerInterface |
||
38 | 196 | */ |
|
39 | protected $entityManager; |
||
40 | 196 | ||
41 | /** |
||
42 | * StockReduceProcessor constructor. |
||
43 | * |
||
44 | * @param ProductStockRepository $productStockRepository |
||
45 | * @param EntityManagerInterface $entityManager |
||
46 | */ |
||
47 | public function __construct(ProductStockRepository $productStockRepository, EntityManagerInterface $entityManager) |
||
52 | |||
53 | /* |
||
54 | * ItemHolderValidator |
||
55 | */ |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | 2 | protected function validate(ItemHolderInterface $itemHolder, PurchaseContext $context) |
|
64 | |||
65 | 10 | /* |
|
66 | * PurchaseProcessor |
||
67 | */ |
||
68 | 10 | ||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | 10 | public function prepare(ItemHolderInterface $itemHolder, PurchaseContext $context) |
|
79 | 6 | ||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | 6 | */ |
|
83 | 6 | public function commit(ItemHolderInterface $target, PurchaseContext $context) |
|
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | public function rollback(ItemHolderInterface $itemHolder, PurchaseContext $context) |
||
98 | |||
99 | private function eachProductOrderItems(ItemHolderInterface $itemHolder, callable $callback) |
||
125 | } |
||
126 |