Files
core/src/Privacy/DTOs/CustomerSubject.php
T

29 lines
1.0 KiB
PHP
Raw Normal View History

2026-08-24 21:06:11 +03:00
<?php
namespace Modules\Core\Privacy\DTOs;
2026-08-24 21:06:11 +03:00
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);
}
}