<?php namespace App\Entity; use App\Annotation\Exportable; use App\Annotation\ExportableEntity; use App\Repository\UserExtensionRepository; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity(repositoryClass=UserExtensionRepository::class) * * @ExportableEntity */ class UserExtension { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private ?int $id = NULL; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="extensions") * @ORM\JoinColumn(nullable=false) * * @Assert\NotNull */ private ?User $user = NULL; /** * @ORM\Column(type="string", length=64) * * @Assert\NotBlank * @Assert\Length( * min = 3, * max = 64, * ) * * @Exportable("slug") */ private ?string $slug = NULL; /** * @ORM\Column(type="text") * * @Assert\NotBlank * * @Exportable("value") */ private ?string $value = NULL; public function getSerialized(): string { return $this->getSlug() . ':' . $this->getValue(); } public function getId(): ?int { return $this->id; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; } public function getSlug(): ?string { return $this->slug; } public function setSlug(string $slug): self { $this->slug = $slug; return $this; } public function getValue(): ?string { return $this->value; } public function setValue(string $value): self { $this->value = $value; return $this; } }