29 lines
1.0 KiB
PHP
29 lines
1.0 KiB
PHP
<?php
|
|||
|
|
|
||
|
|
namespace Modules\Core\Privacy;
|
||
|
|
|
||
|
|
use Lunar\Models\Customer;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Identifies "the business account" for a Customer-scoped data-subject request —
|
||
|
|
* erasing/exporting a Customer's own data (orders, addresses, the account record
|
||
|
|
* itself). Deliberately carries no userIds/email: Customer-scope must never touch
|
||
|
|
* any linked User's login or personal identity, only the account's own data — see
|
||
|
|
* docs/privacy.md "User-scope vs Customer-scope". A provider that needs to know
|
||
|
|
* which Users are linked (e.g. to export their names as account contacts, without
|
||
|
|
* erasing their logins) looks that up itself via the Customer model, rather than
|
||
|
|
* this value object handing it out — keeping "erase a Customer" structurally
|
||
|
|
* incapable of touching a User row is the whole point of the split.
|
||
|
|
*/
|
||
|
|
class CustomerSubject
|
||
|
|
{
|
||
|
|
public function __construct(
|
||
|
|
public readonly int $customerId,
|
||
|
|
) {}
|
||
|
|
|
||
|
|
public static function forCustomer(Customer $customer): self
|
||
|
|
{
|
||
|
|
return new self(customerId: $customer->id);
|
||
|
|
}
|
||
|
|
}
|