ldc-boutique-cnc-sable/shared/ValueObjects/CrmHashcode.php
Jérémy Munsch 2aa4fa8aed
feat(crm): implement unsubscribe from newsletter functionality
- Added UnsubscribeFromNewsletter action and input/output classes.
- Introduced CrmHashcode value object and its cast.
- Updated NewsletterController to use the new unsubscribe action.
- Enhanced validation in UnsubscribeNewsletterRequest.
2026-10-27 09:58:34 +01:00

29 lines
590 B
PHP

<?php
declare(strict_types=1);
namespace Shared\ValueObjects;
use Ramsey\Uuid\UuidInterface;
use Shared\Helpers\UuidHelper;
final readonly class CrmHashcode implements \Stringable
{
public string $value;
public function __construct(
UuidInterface $value,
) {
UuidHelper::validateUuid($value);
if (! UuidHelper::isV4($value)) {
throw new \DomainException('CrmHashcode is not a valid uuidv4');
}
$this->value = $value->toString();
}
public function __toString(): string
{
return $this->value;
}
}