src/Entity/UserTemplate.php line 10

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserTemplateRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassUserTemplateRepository::class)]
  6. #[ORM\Table(name'user_template')]
  7. class UserTemplate
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private ?int $id null;
  13.     // ✅ Made nullable to avoid validation errors for virtual fields in Sonata
  14.     #[ORM\ManyToOne(targetEntityPage::class)]
  15.     #[ORM\JoinColumn(nullabletrueonDelete'CASCADE')]
  16.     private ?Page $page null;
  17.     // ✅ Made nullable to avoid validation errors for virtual fields in Sonata
  18.     #[ORM\ManyToOne(targetEntityUser::class)]
  19.     #[ORM\JoinColumn(nullabletrueonDelete'CASCADE')]
  20.     private ?User $user null;
  21.     #[ORM\Column(type'integer'nullabletrue)]
  22.     private ?int $type null;
  23.     public function getId(): ?int
  24.     {
  25.         return $this->id;
  26.     }
  27.     public function getPage(): ?Page
  28.     {
  29.         return $this->page;
  30.     }
  31.     public function setPage(?Page $page): self
  32.     {
  33.         $this->page $page;
  34.         return $this;
  35.     }
  36.     public function getUser(): ?User
  37.     {
  38.         return $this->user;
  39.     }
  40.     public function setUser(?User $user): self
  41.     {
  42.         $this->user $user;
  43.         return $this;
  44.     }
  45.     public function getType(): ?int
  46.     {
  47.         return $this->type;
  48.     }
  49.     public function setType(?int $type): self
  50.     {
  51.         $this->type $type;
  52.         return $this;
  53.     }
  54. }