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

STA-960 | add dto and cast from entities

parent 6c9559e6
Loading
Loading
Loading
Loading

app/src/DTO/RestaurantListDTO.php

deleted100644 → 0
+0 −10
Original line number Diff line number Diff line
<?php

namespace App\DTO;

class RestaurantListDTO
{
    private $pagination;
    private $list;
    private $filterVariants;
}
 No newline at end of file
+0 −15
Original line number Diff line number Diff line
<?php

namespace App\DTO;

class RestaurantListingElementDTO
{
    private $id;
    private $name;
    private $code;
    private $type;
    private $check;
    private $image;
    private $detailLink;

}
 No newline at end of file
+29 −0
Original line number Diff line number Diff line
<?php

namespace App\Dto;

use JsonSerializable;
use Ramsey\Collection\AbstractCollection;

/** Переопределенная коллекция, что бы можно было сериалайзить коллекции */
class DtoCollection extends AbstractCollection implements JsonSerializable
{
    public function __construct(
        private readonly string $collectionType,
        array $data = []
    ) {
        parent::__construct($data);
    }

    /** @return string */
    public function getType(): string
    {
        return $this->collectionType;
    }

    /** Метод для сериализации коллекции в JSON */
    public function jsonSerialize(): array
    {
        return $this->data;
    }
}
+6 −0
Original line number Diff line number Diff line
<?php

namespace App\Dto;

/** Инетерфейс, необходимый для реализации протота */
interface DtoInterface {}
+12 −0
Original line number Diff line number Diff line
<?php

namespace App\Dto;

class ErrorDto implements DtoInterface
{
    public string $status;

    public string $message;

    public string $code;
}
Loading