- Spatie/DataTransferObject 대비
- MapFrom,MapTo -> RawName
- Strict -> 항상
- 심지어 raw type도 더 까다롭게
- array에 MapConverter 적용
- NullIsUndefined 적용
- 빈 nullable arg자리에 null 강제 지정
- Vue3에 v-model.number 지정
- input type="number" 기준
45 lines
804 B
PHP
45 lines
804 B
PHP
<?php
|
|
|
|
namespace sammo\DTO;
|
|
|
|
use sammo\DTO\Attr\Convert;
|
|
use sammo\DTO\Converter\MapConverter;
|
|
use sammo\DTO\SelectItem;
|
|
|
|
//https://json2dto.atymic.dev/
|
|
|
|
class BettingInfo extends DTO
|
|
{
|
|
public function __construct(
|
|
public int $id,
|
|
public string $type,
|
|
public string $name,
|
|
public bool $finished,
|
|
public int $selectCnt,
|
|
public ?bool $isExclusive,
|
|
public bool $reqInheritancePoint,
|
|
public int $openYearMonth,
|
|
public int $closeYearMonth,
|
|
|
|
|
|
/** @var \sammo\DTO\SelectItem[] */
|
|
#[Convert(MapConverter::class, [SelectItem::class])]
|
|
public array $candidates,
|
|
public ?array $winner,
|
|
) {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
{
|
|
"id": 45,
|
|
"name": "1차전",
|
|
"finished": false,
|
|
"selectCnt": 1,
|
|
"reqInheritancePoint": true,
|
|
"openYearMonth": 110,
|
|
"closeYearMonth": 120
|
|
}
|
|
*/ |