<?php
declare(strict_types=1);
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Embeddable()
*/
class Name
{
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank(
* message="お名前(名)を入力してください",
* groups="guest"
* )
* @Assert\Length(
* max=100
* )
*/
private ?string $first = null;
/**
* @ORM\Column(type="string", nullable=true)
* @Assert\NotBlank(
* message="お名前(姓)を入力してください",
* groups="guest"
* )
* @Assert\Length(
* max=100
* )
*/
private ?string $last = null;
public function getFirst(): ?string
{
return $this->first;
}
public function setFirst(?string $first): Name
{
$this->first = $first;
return $this;
}
public function getLast(): ?string
{
return $this->last;
}
public function setLast(?string $last): Name
{
$this->last = $last;
return $this;
}
public function __toString(): string
{
return "{$this->last} {$this->first}";
}
}