|
9 | 9 |
|
10 | 10 | class B2bConfigurableAddOrReplaceStrategy extends ConfigurableAddOrReplaceStrategy
|
11 | 11 | {
|
12 |
| - /** |
13 |
| - * Save state about exists Billing Address value in entity or not. |
14 |
| - * Value is updated in function beforeProcessEntity and used |
15 |
| - * in function afterProcessEntity |
16 |
| - * |
17 |
| - * @var bool |
18 |
| - */ |
19 |
| - protected $isBillingAddress = true; |
20 |
| - |
21 |
| - /** |
22 |
| - * Save state about exists Shipping Address value in entity or not. |
23 |
| - * Value is updated in function beforeProcessEntity and used |
24 |
| - * in function afterProcessEntity |
25 |
| - * |
26 |
| - * @var bool |
27 |
| - */ |
28 |
| - protected $isShippingAddress = true; |
29 |
| - |
30 |
| - /** |
31 |
| - * {@inheritdoc} |
32 |
| - */ |
33 |
| - protected function beforeProcessEntity($entity) |
34 |
| - { |
35 |
| - /** @var B2bCustomer $entity */ |
36 |
| - $entity = parent::beforeProcessEntity($entity); |
37 |
| - $this->checkEmptyAddresses($entity); |
38 |
| - |
39 |
| - return $entity; |
40 |
| - } |
41 |
| - |
42 | 12 | /**
|
43 | 13 | * {@inheritdoc}
|
44 | 14 | */
|
45 | 15 | protected function afterProcessEntity($entity)
|
46 | 16 | {
|
47 | 17 | /** @var B2bCustomer $entity */
|
48 | 18 | $entity = parent::afterProcessEntity($entity);
|
49 |
| - $this->clearEmptyAddresses($entity); |
50 | 19 |
|
51 | 20 | $this->guessRegion($entity->getBillingAddress());
|
52 | 21 | $this->guessRegion($entity->getShippingAddress());
|
53 | 22 |
|
54 | 23 | return $entity;
|
55 | 24 | }
|
56 | 25 |
|
57 |
| - /** |
58 |
| - * @param B2bCustomer $entity |
59 |
| - */ |
60 |
| - protected function checkEmptyAddresses(B2bCustomer $entity) |
61 |
| - { |
62 |
| - if (!$entity->getBillingAddress()) { |
63 |
| - $this->isBillingAddress = false; |
64 |
| - } |
65 |
| - |
66 |
| - if (!$entity->getShippingAddress()) { |
67 |
| - $this->isShippingAddress = false; |
68 |
| - } |
69 |
| - } |
70 |
| - |
71 |
| - /** |
72 |
| - * @param B2bCustomer $entity |
73 |
| - */ |
74 |
| - protected function clearEmptyAddresses(B2bCustomer $entity) |
75 |
| - { |
76 |
| - if (!$this->isBillingAddress) { |
77 |
| - $entity->setBillingAddress(null); |
78 |
| - } |
79 |
| - |
80 |
| - if (!$this->isShippingAddress) { |
81 |
| - $entity->setShippingAddress(null); |
82 |
| - } |
83 |
| - } |
84 |
| - |
85 | 26 | /**
|
86 | 27 | * @param Address $address
|
87 | 28 | */
|
|
0 commit comments