136 lines
2.7 KiB
PHP
136 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\UsersOrganizationsRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: UsersOrganizationsRepository::class)]
|
|
class UsersOrganizations
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\ManyToOne]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private ?user $users = null;
|
|
|
|
#[ORM\ManyToOne]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private ?Organizations $organization = null;
|
|
|
|
#[ORM\ManyToOne]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private ?Roles $role = null;
|
|
|
|
#[ORM\Column(options: ['default' => true])]
|
|
private ?bool $isActive = null;
|
|
|
|
/**
|
|
* @var Collection<int, Apps>
|
|
*/
|
|
#[ORM\ManyToMany(targetEntity: Apps::class)]
|
|
private Collection $apps;
|
|
|
|
#[ORM\Column(nullable:true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
|
private ?\DateTimeImmutable $createdAt = null;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->apps = new ArrayCollection();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getUsers(): ?user
|
|
{
|
|
return $this->users;
|
|
}
|
|
|
|
public function setUsers(?user $users): static
|
|
{
|
|
$this->users = $users;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getOrganization(): ?organizations
|
|
{
|
|
return $this->organization;
|
|
}
|
|
|
|
public function setOrganization(?organizations $organization): static
|
|
{
|
|
$this->organization = $organization;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getRole(): ?roles
|
|
{
|
|
return $this->role;
|
|
}
|
|
|
|
public function setRole(?roles $role): static
|
|
{
|
|
$this->role = $role;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function isActive(): ?bool
|
|
{
|
|
return $this->isActive;
|
|
}
|
|
|
|
public function setIsActive(bool $isActive): static
|
|
{
|
|
$this->isActive = $isActive;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, apps>
|
|
*/
|
|
public function getApps(): Collection
|
|
{
|
|
return $this->apps;
|
|
}
|
|
|
|
public function addApp(apps $app): static
|
|
{
|
|
if (!$this->apps->contains($app)) {
|
|
$this->apps->add($app);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeApp(apps $app): static
|
|
{
|
|
$this->apps->removeElement($app);
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCreatedAt(): ?\DateTimeImmutable
|
|
{
|
|
return $this->createdAt;
|
|
}
|
|
|
|
public function setCreatedAt(?\DateTimeImmutable $createdAt): static
|
|
{
|
|
$this->createdAt = $createdAt;
|
|
|
|
return $this;
|
|
}
|
|
}
|