|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace Shopware\Core\Checkout\Customer\Event; |
|
4
|
|
|
|
|
5
|
|
|
use Shopware\Core\Checkout\Customer\Aggregate\CustomerRecovery\CustomerRecoveryDefinition; |
|
6
|
|
|
use Shopware\Core\Checkout\Customer\Aggregate\CustomerRecovery\CustomerRecoveryEntity; |
|
|
|
|
|
|
7
|
|
|
use Shopware\Core\Checkout\Customer\CustomerDefinition; |
|
8
|
|
|
use Shopware\Core\Checkout\Customer\CustomerEntity; |
|
|
|
|
|
|
9
|
|
|
use Shopware\Core\Content\Flow\Dispatching\Action\FlowMailVariables; |
|
10
|
|
|
use Shopware\Core\Content\Flow\Dispatching\Aware\CustomerRecoveryAware; |
|
11
|
|
|
use Shopware\Core\Content\Flow\Dispatching\Aware\ResetUrlAware; |
|
12
|
|
|
use Shopware\Core\Content\Flow\Dispatching\Aware\ScalarValuesAware; |
|
13
|
|
|
use Shopware\Core\Content\Flow\Dispatching\Aware\ShopNameAware; |
|
14
|
|
|
use Shopware\Core\Framework\Context; |
|
15
|
|
|
use Shopware\Core\Framework\Event\CustomerAware; |
|
16
|
|
|
use Shopware\Core\Framework\Event\EventData\EntityType; |
|
17
|
|
|
use Shopware\Core\Framework\Event\EventData\EventDataCollection; |
|
18
|
|
|
use Shopware\Core\Framework\Event\EventData\MailRecipientStruct; |
|
19
|
|
|
use Shopware\Core\Framework\Event\EventData\ScalarValueType; |
|
20
|
|
|
use Shopware\Core\Framework\Event\MailAware; |
|
21
|
|
|
use Shopware\Core\Framework\Event\SalesChannelAware; |
|
22
|
|
|
use Shopware\Core\Framework\Event\ShopwareSalesChannelEvent; |
|
23
|
|
|
use Shopware\Core\Framework\Log\Package; |
|
24
|
|
|
use Shopware\Core\System\SalesChannel\SalesChannelContext; |
|
25
|
|
|
use Symfony\Contracts\EventDispatcher\Event; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @deprecated tag:v6.6.0 - reason:class-hierarchy-change - ResetUrlAware and ShopNameAware are deprecated and will be removed in v6.6.0 |
|
29
|
|
|
*/ |
|
30
|
|
|
#[Package('customer-order')] |
|
31
|
|
|
class CustomerAccountRecoverRequestEvent extends Event implements SalesChannelAware, ShopwareSalesChannelEvent, CustomerAware, MailAware, CustomerRecoveryAware, ResetUrlAware, ShopNameAware, ScalarValuesAware |
|
|
|
|
|
|
32
|
|
|
{ |
|
33
|
|
|
public const EVENT_NAME = 'customer.recovery.request'; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @var CustomerRecoveryEntity |
|
37
|
|
|
*/ |
|
38
|
|
|
private $customerRecovery; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @var SalesChannelContext |
|
42
|
|
|
*/ |
|
43
|
|
|
private $salesChannelContext; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @var string |
|
47
|
|
|
*/ |
|
48
|
|
|
private $resetUrl; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @var string |
|
52
|
|
|
*/ |
|
53
|
|
|
private $shopName; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @var MailRecipientStruct |
|
57
|
|
|
*/ |
|
58
|
|
|
private $mailRecipientStruct; |
|
59
|
|
|
|
|
60
|
|
|
public function __construct( |
|
61
|
|
|
SalesChannelContext $salesChannelContext, |
|
62
|
|
|
CustomerRecoveryEntity $customerRecovery, |
|
63
|
|
|
string $resetUrl |
|
64
|
|
|
) { |
|
65
|
|
|
$this->salesChannelContext = $salesChannelContext; |
|
66
|
|
|
$this->customerRecovery = $customerRecovery; |
|
67
|
|
|
$this->resetUrl = $resetUrl; |
|
68
|
|
|
$this->shopName = $salesChannelContext->getSalesChannel()->getTranslation('name'); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @return array<string, scalar|array<mixed>|null> |
|
73
|
|
|
*/ |
|
74
|
|
|
public function getValues(): array |
|
75
|
|
|
{ |
|
76
|
|
|
return [ |
|
77
|
|
|
FlowMailVariables::RESET_URL => $this->resetUrl, |
|
78
|
|
|
FlowMailVariables::SHOP_NAME => $this->shopName, |
|
79
|
|
|
]; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
public function getName(): string |
|
83
|
|
|
{ |
|
84
|
|
|
return self::EVENT_NAME; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
public function getCustomerRecovery(): CustomerRecoveryEntity |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->customerRecovery; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
public function getSalesChannelContext(): SalesChannelContext |
|
93
|
|
|
{ |
|
94
|
|
|
return $this->salesChannelContext; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
public function getContext(): Context |
|
98
|
|
|
{ |
|
99
|
|
|
return $this->salesChannelContext->getContext(); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
public static function getAvailableData(): EventDataCollection |
|
103
|
|
|
{ |
|
104
|
|
|
return (new EventDataCollection()) |
|
105
|
|
|
->add('customerRecovery', new EntityType(CustomerRecoveryDefinition::class)) |
|
106
|
|
|
->add('customer', new EntityType(CustomerDefinition::class)) |
|
107
|
|
|
->add('resetUrl', new ScalarValueType(ScalarValueType::TYPE_STRING)) |
|
108
|
|
|
->add('shopName', new ScalarValueType(ScalarValueType::TYPE_STRING)); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
public function getMailStruct(): MailRecipientStruct |
|
112
|
|
|
{ |
|
113
|
|
|
if (!$this->mailRecipientStruct instanceof MailRecipientStruct) { |
|
|
|
|
|
|
114
|
|
|
/** @var CustomerEntity $customer */ |
|
115
|
|
|
$customer = $this->customerRecovery->getCustomer(); |
|
116
|
|
|
|
|
117
|
|
|
$this->mailRecipientStruct = new MailRecipientStruct([ |
|
118
|
|
|
$customer->getEmail() => $customer->getFirstName() . ' ' . $customer->getLastName(), |
|
119
|
|
|
]); |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
return $this->mailRecipientStruct; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
public function getSalesChannelId(): string |
|
126
|
|
|
{ |
|
127
|
|
|
return $this->salesChannelContext->getSalesChannel()->getId(); |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
public function getResetUrl(): string |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->resetUrl; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
public function getShopName(): string |
|
136
|
|
|
{ |
|
137
|
|
|
return $this->shopName; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
public function getCustomer(): ?CustomerEntity |
|
141
|
|
|
{ |
|
142
|
|
|
return $this->customerRecovery->getCustomer(); |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
public function getCustomerId(): string |
|
146
|
|
|
{ |
|
147
|
|
|
return $this->getCustomerRecovery()->getCustomerId(); |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
public function getCustomerRecoveryId(): string |
|
151
|
|
|
{ |
|
152
|
|
|
return $this->customerRecovery->getId(); |
|
153
|
|
|
} |
|
154
|
|
|
} |
|
155
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths