@@ 154-175 (lines=22) @@ | ||
151 | * |
|
152 | * @return null|object |
|
153 | */ |
|
154 | protected function findRegionEntity($entity) |
|
155 | { |
|
156 | $existingEntity = null; |
|
157 | ||
158 | /** @var \OroCRM\Bundle\MagentoBundle\Entity\Region $magentoRegion */ |
|
159 | $magentoRegion = $this->databaseHelper->findOneBy( |
|
160 | 'OroCRM\Bundle\MagentoBundle\Entity\Region', |
|
161 | [ |
|
162 | 'regionId' => $entity->getCombinedCode() |
|
163 | ] |
|
164 | ); |
|
165 | if ($magentoRegion) { |
|
166 | $existingEntity = $this->databaseHelper->findOneBy( |
|
167 | 'Oro\Bundle\AddressBundle\Entity\Region', |
|
168 | [ |
|
169 | 'combinedCode' => $magentoRegion->getCombinedCode() |
|
170 | ] |
|
171 | ); |
|
172 | } |
|
173 | ||
174 | return $existingEntity; |
|
175 | } |
|
176 | } |
|
177 |
@@ 199-220 (lines=22) @@ | ||
196 | * |
|
197 | * @return null|object |
|
198 | */ |
|
199 | protected function findRegionEntity($entity, $existingEntity) |
|
200 | { |
|
201 | if (!$existingEntity && $entity instanceof Region) { |
|
202 | /** @var \OroCRM\Bundle\MagentoBundle\Entity\Region $magentoRegion */ |
|
203 | $magentoRegion = $this->databaseHelper->findOneBy( |
|
204 | 'OroCRM\Bundle\MagentoBundle\Entity\Region', |
|
205 | [ |
|
206 | 'regionId' => $entity->getCode() |
|
207 | ] |
|
208 | ); |
|
209 | if ($magentoRegion) { |
|
210 | $existingEntity = $this->databaseHelper->findOneBy( |
|
211 | 'Oro\Bundle\AddressBundle\Entity\Region', |
|
212 | [ |
|
213 | 'combinedCode' => $magentoRegion->getCombinedCode() |
|
214 | ] |
|
215 | ); |
|
216 | } |
|
217 | } |
|
218 | ||
219 | return $existingEntity; |
|
220 | } |
|
221 | ||
222 | /** |
|
223 | * Add special identifier for entities not existing in Magento |