Commit f1913325 authored by Александр Плохих's avatar Александр Плохих 🌔
Browse files

STA-950 | hotfix restaurants tags

parent a0a2dda6
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -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,
    ) {}
}
+8 −14
Original line number Diff line number Diff line
@@ -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;
    }
}