Profile.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProfileRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClass: ProfileRepository::class)]
  6. class Profile
  7. {
  8. public static $VIEW = ['liste' => 0, 'vignette' => 1];
  9. #[ORM\Id]
  10. #[ORM\GeneratedValue]
  11. #[ORM\Column(type: "integer")]
  12. private $id;
  13. #[ORM\OneToOne(targetEntity: User::class, inversedBy: "profile", cascade: ["persist", "remove"])]
  14. #[ORM\JoinColumn(nullable: false)]
  15. private $user;
  16. #[ORM\Column(type: "integer")]
  17. private $view;
  18. public function __construct()
  19. {
  20. $this->setView(Profile::$VIEW['vignette']);
  21. }
  22. public function getId(): ?int
  23. {
  24. return $this->id;
  25. }
  26. public function getUser(): ?User
  27. {
  28. return $this->user;
  29. }
  30. public function setUser(User $user): self
  31. {
  32. $this->user = $user;
  33. return $this;
  34. }
  35. public function getView(): ?int
  36. {
  37. return $this->view;
  38. }
  39. public function setView(int $view): self
  40. {
  41. $this->view = $view;
  42. return $this;
  43. }
  44. }