Пользовательский DTO:
Код: Выделить всё
#[Assert\Choice(callback: 'getConditionTypes')]
public string $conditionType;
public static function getConditionTypes(): array
{
return array_column(ConditionType::cases(), 'name');
}
Код: Выделить всё
enum ConditionType: string
{
case NEW = "NEW";
case USED = "USED";
case CRASHED = "CRASHED";
case BROKEN = "BROKEN";
case FOR_PARTS = "FOR_PARTS";
}
Подробнее здесь: https://stackoverflow.com/questions/765 ... ert-choice
Мобильная версия