. */ declare(strict_types=1); namespace App\Entity\Base; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; /** * Trait providing named element functionality. */ trait NamedElementTrait { /** * @var string The name of this element */ #[Assert\NotBlank] #[Groups(['simple', 'extended', 'full', 'import', 'api:basic:read', 'api:basic:write'])] #[ORM\Column(type: Types::STRING)] #[Assert\Length(max: 255)] protected string $name = ''; /** * Get the name of this element. * * @return string the name of this element */ public function getName(): string { return $this->name; } /** * Change the name of this element. * * @param string $new_name the new name */ public function setName(string $new_name): self { $this->name = $new_name; return $this; } /** * String representation returns the name. */ public function __toString(): string { return $this->getName(); } }