src/Entity/UserStudio.php line 10

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserStudioRepository;
  4. use DateTimeImmutable;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassUserStudioRepository::class)]
  7. class UserStudio
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\Column]
  14.     private ?int $user_id null;
  15.     #[ORM\OneToOne(mappedBy'userStudio'targetEntityUser::class)]
  16.     protected User $user;
  17.     #[ORM\Column(nullabletrue)]
  18.     private array $berechtigungen = [];
  19.     #[ORM\Column]
  20.     private ?DateTimeImmutable $createdAt null;
  21.     public function __construct()
  22.     {
  23.         $this->berechtigungen = [];
  24.         $this->createdAt = new DateTimeImmutable();
  25.     }
  26.     public function getId(): ?int
  27.     {
  28.         return $this->id;
  29.     }
  30.     public function getBerechtigungen(): array
  31.     {
  32.         return $this->berechtigungen;
  33.     }
  34.     public function setBerechtigungen(?array $berechtigungen): self
  35.     {
  36.         $this->berechtigungen $berechtigungen;
  37.         return $this;
  38.     }
  39.     public function getCreatedAt(): ?DateTimeImmutable
  40.     {
  41.         return $this->createdAt;
  42.     }
  43.     public function setCreatedAt(DateTimeImmutable $createdAt): self
  44.     {
  45.         $this->createdAt $createdAt;
  46.         return $this;
  47.     }
  48.     public function getUser(): ?User
  49.     {
  50.         return $this->user;
  51.     }
  52.     public function setUser(?User $user): self
  53.     {
  54.         // unset the owning side of the relation if necessary
  55.         if ($user === null && $this->user !== null) {
  56.             $this->user->setUserStudio(null);
  57.         }
  58.         // set the owning side of the relation if necessary
  59.         if ($user !== null && $user->getUserStudio() !== $this) {
  60.             $user->setUserStudio($this);
  61.         }
  62.         $this->user $user;
  63.         return $this;
  64.     }
  65.     public function getUserId(): ?int
  66.     {
  67.         return $this->user_id;
  68.     }
  69.     public function setUserId(int $user_id): self
  70.     {
  71.         $this->user_id $user_id;
  72.         return $this;
  73.     }
  74. }