1 | <?php |
||
38 | class VariantSuperLinkObserver extends AbstractProductImportObserver |
||
39 | { |
||
40 | |||
41 | /** |
||
42 | * The product variant processor instance. |
||
43 | * |
||
44 | * @var \TechDivision\Import\Product\Variant\Services\ProductVariantProcessorInterface |
||
45 | */ |
||
46 | protected $productVariantProcessor; |
||
47 | |||
48 | /** |
||
49 | * Initialize the observer with the passed product variant processor instance. |
||
50 | * |
||
51 | * @param \TechDivision\Import\Product\Variant\Services\ProductVariantProcessorInterface $productVariantProcessor The product variant processor instance |
||
52 | */ |
||
53 | public function __construct(ProductVariantProcessorInterface $productVariantProcessor) |
||
57 | |||
58 | /** |
||
59 | * Return's the product variant processor instance. |
||
60 | * |
||
61 | * @return \TechDivision\Import\Product\Variant\Services\ProductVariantProcessorInterface The product variant processor instance |
||
62 | */ |
||
63 | protected function getProductVariantProcessor() |
||
67 | |||
68 | /** |
||
69 | * Process the observer's business logic. |
||
70 | * |
||
71 | * @return array The processed row |
||
72 | */ |
||
73 | protected function process() |
||
134 | |||
135 | /** |
||
136 | * Prepare the product super link attributes that has to be persisted. |
||
137 | * |
||
138 | * @return array The prepared product super link attributes |
||
139 | */ |
||
140 | protected function prepareProductSuperLinkAttributes() |
||
151 | |||
152 | /** |
||
153 | * Initialize the product super link with the passed attributes and returns an instance. |
||
154 | * |
||
155 | * @param array $attr The product super link attributes |
||
156 | * |
||
157 | * @return array|null The initialized product super link, or null if the super link already exsist |
||
158 | */ |
||
159 | protected function initializeProductSuperLink(array $attr) |
||
163 | |||
164 | /** |
||
165 | * Return the entity ID for the passed SKU. |
||
166 | * |
||
167 | * @param string $sku The SKU to return the entity ID for |
||
168 | * |
||
169 | * @return integer The mapped entity ID |
||
170 | * @throws \Exception Is thrown if the SKU is not mapped yet |
||
171 | */ |
||
172 | protected function mapSku($sku) |
||
176 | |||
177 | /** |
||
178 | * Return the entity ID for the passed child SKU. |
||
179 | * |
||
180 | * @param string $sku The SKU to return the entity ID for |
||
181 | * |
||
182 | * @return integer The mapped entity ID |
||
183 | * @throws \Exception Is thrown if the SKU is not mapped yet |
||
184 | */ |
||
185 | protected function mapChildSku($sku) |
||
189 | |||
190 | /** |
||
191 | * Persist's the passed product super link data and return's the ID. |
||
192 | * |
||
193 | * @param array $productSuperLink The product super link data to persist |
||
194 | * |
||
195 | * @return void |
||
196 | */ |
||
197 | protected function persistProductSuperLink($productSuperLink) |
||
201 | } |
||
202 |
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: