ufo-tech/rpc-objects

Component for UFO-Tech RPC Library

Installs: 2 182

Dependents: 3

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 3

Open Issues: 0

Type:component

2.8.0 2025-03-13 22:01 UTC

This package is auto-updated.

Last update: 2025-03-14 16:39:50 UTC


README

Component for UFO-Tech RPC Library

Example DTO with Assertions

namespace App\DTO;

use Ufo\RpcObject\DTO\ArrayConstructibleTrait;
use Ufo\RpcObject\DTO\ArrayConvertibleTrait;
use Ufo\RpcObject\DTO\IArrayConstructible;
use Ufo\RpcObject\DTO\IArrayConvertible;
use Symfony\Component\Validator\Constraints as Assert;
use Ufo\RpcObject\RPC;

class CarDTO implements IArrayConvertible, IArrayConstructible
{
    use ArrayConstructibleTrait, ArrayConvertibleTrait;

    public function __construct(
        #[RPC\Assertions([new Assert\NotBlank(), new Assert\Length(min: 2, max: 50)])]
        public string $brand,
        
        #[RPC\Assertions([new Assert\NotBlank(), new Assert\Length(min: 1, max: 50)])]
        public string $model,

        #[RPC\Assertions([new Assert\Range(min: 1886, max: 2100)])]
        public int $year,

        #[RPC\Assertions([new Assert\Range(min: 0)])]
        public int $mileage = 0
    ) {}
}