ldc-boutique-cnc-sable/domain/Enums/Units/OrderUnit.php
Jérémy Munsch c40016bba1
feat(order): implement order placement and related DTOs
- Add methods to convert OrderLine and DeliveryAddress to DTOs.
- Introduce toPlacedEvent method in Order to generate domain event.
- Enhance OrderUnit with Regate code mapping.
- Implement tests for new functionality and ensure correctness.
2026-10-29 20:35:13 +01:00

37 lines
737 B
PHP

<?php
declare(strict_types=1);
namespace Domain\Enums\Units;
use Shared\Enums\BaseEnum;
enum OrderUnit: string
{
/** @use \Shared\Enums\BaseEnum<string> */
use BaseEnum;
case PCE = 'PCE';
case KGM = 'KGM';
case COLIS = 'COLIS';
public function toRegateCode(): string
{
return match ($this) {
self::COLIS => 'UEA',
self::KGM => 'KGM',
self::PCE => 'UB',
};
}
/**
* Optionnal labels definition
*
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
*/
private const LABELS = [
self::PCE->name => 'Pièce',
self::KGM->name => 'Kg',
self::COLIS->name => 'Colis',
];
}