1 | <?php |
||
20 | class ExportSaveProducts |
||
21 | { |
||
22 | /** |
||
23 | * @var PersonalisedProductsLogger |
||
24 | */ |
||
25 | private $_logger; |
||
26 | |||
27 | /** |
||
28 | * @var Config |
||
29 | */ |
||
30 | private $_config; |
||
31 | |||
32 | /** |
||
33 | * @var Export |
||
34 | */ |
||
35 | private $_export; |
||
36 | |||
37 | /** |
||
38 | * @var ExportFactory |
||
39 | */ |
||
40 | private $_exportFactory; |
||
41 | |||
42 | /** |
||
43 | * ExportSaveProducts constructor. |
||
44 | * @param PersonalisedProductsLogger $logger |
||
45 | * @param Config $config |
||
46 | * @param Export $export |
||
47 | * @param ObjectManagerInterface $objectManager |
||
48 | * @param ManagerInterface $eventManager |
||
49 | */ |
||
50 | public function __construct( |
||
65 | |||
66 | /** |
||
67 | * Plugin into the afterSave method on a product |
||
68 | * |
||
69 | * @param Product $product |
||
70 | * @param $result |
||
71 | * @return mixed |
||
72 | */ |
||
73 | public function afterAfterSave(Product $product, $result) |
||
78 | |||
79 | /** |
||
80 | * Save the new product ready for export |
||
81 | * |
||
82 | * @param $productId |
||
83 | */ |
||
84 | private function _saveProductForExport($productId) |
||
95 | |||
96 | /** |
||
97 | * Check the product exists in the export table |
||
98 | * |
||
99 | * @param $productId |
||
100 | * @return bool |
||
101 | */ |
||
102 | private function _isReadyForExport($productId) |
||
110 | } |
||
111 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: