Loading app/src/Dto/TagDto.php +9 −3 Original line number Diff line number Diff line Loading @@ -4,8 +4,14 @@ namespace App\Dto; class TagDto implements DtoInterface { public string $name; /** * @param string $name * @param DtoCollection<string> $list */ public function __construct( public string $name, /** @var DtoCollection<string> */ public DtoCollection $list; public DtoCollection $list, ) {} } app/src/Entity/Restaurants.php +8 −14 Original line number Diff line number Diff line Loading @@ -495,19 +495,13 @@ class Restaurants implements PrototypeElementDto ) ); return new DtoCollection( TagDto::class, $jsonCollection ->map(function(array $tag) { $tagDto = new TagDto(); $tagDto->name = key($tag); $tagDto->list = new DtoCollection( 'string', $tag ); return $tagDto; }) ->toArray() $tagCollection = new DtoCollection(TagDto::class); foreach ($jsonCollection as $name => $jsonItem) { $tagCollection->add( new TagDto($name, new DtoCollection('string', $jsonItem)) ); } return $tagCollection; } } Loading
app/src/Dto/TagDto.php +9 −3 Original line number Diff line number Diff line Loading @@ -4,8 +4,14 @@ namespace App\Dto; class TagDto implements DtoInterface { public string $name; /** * @param string $name * @param DtoCollection<string> $list */ public function __construct( public string $name, /** @var DtoCollection<string> */ public DtoCollection $list; public DtoCollection $list, ) {} }
app/src/Entity/Restaurants.php +8 −14 Original line number Diff line number Diff line Loading @@ -495,19 +495,13 @@ class Restaurants implements PrototypeElementDto ) ); return new DtoCollection( TagDto::class, $jsonCollection ->map(function(array $tag) { $tagDto = new TagDto(); $tagDto->name = key($tag); $tagDto->list = new DtoCollection( 'string', $tag ); return $tagDto; }) ->toArray() $tagCollection = new DtoCollection(TagDto::class); foreach ($jsonCollection as $name => $jsonItem) { $tagCollection->add( new TagDto($name, new DtoCollection('string', $jsonItem)) ); } return $tagCollection; } }