src/Entity/CompanyMember.php line 13
<?php
namespace App\Entity;
use DateTimeImmutable;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use App\Repository\CompanyMemberRepository;
use Doctrine\Common\Collections\ArrayCollection;
#[ORM\Entity(repositoryClass: CompanyMemberRepository::class)]
class CompanyMember
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $lastEvaluation = null;
#[ORM\Column(length: 50)]
private ?string $firstname = null;
#[ORM\Column(length: 50)]
private ?string $lastname = null;
#[ORM\OneToMany(mappedBy: 'companyMember', targetEntity: Evaluation::class)]
private Collection $evaluations;
#[ORM\ManyToOne(inversedBy: 'companyMembers')]
#[ORM\JoinColumn(nullable: false)]
private ?Company $company = null;
#[ORM\OneToOne(mappedBy: 'companyMember', cascade: ['persist', 'remove'])]
private ?User $user = null;
#[ORM\Column]
private ?bool $active = null;
public function __construct()
{
$this->evaluations = new ArrayCollection();
$this->active = true;
}
public function getName()
{
$name = $this->getFirstname() . ' ' . $this->getLastname();
return $name;
}
public function getId(): ?int
{
return $this->id;
}
public function getLastEvaluation(): ?\DateTimeImmutable
{
return $this->lastEvaluation;
}
public function setLastEvaluation(?\DateTimeImmutable $lastEvaluation): self
{
$this->lastEvaluation = $lastEvaluation;
return $this;
}
public function getFirstname(): ?string
{
return $this->firstname;
}
public function setFirstname(string $firstname): self
{
$this->firstname = $firstname;
return $this;
}
public function getLastname(): ?string
{
return $this->lastname;
}
public function setLastname(string $lastname): self
{
$this->lastname = $lastname;
return $this;
}
/**
* @return Collection<int, Evaluation>
*/
public function getEvaluations(): Collection
{
return $this->evaluations;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): self
{
$this->company = $company;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
// unset the owning side of the relation if necessary
if ($user === null && $this->user !== null) {
$this->user->setCompanyMember(null);
}
// set the owning side of the relation if necessary
if ($user !== null && $user->getCompanyMember() !== $this) {
$user->setCompanyMember($this);
}
$this->user = $user;
return $this;
}
public function isActive(): ?bool
{
return $this->active;
}
public function setActive(bool $active): self
{
$this->active = $active;
return $this;
}
}