<?php
namespace App\Entity;
use App\Repository\CompanyRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CompanyRepository::class)
*/
class Company
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $address;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $contact;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $ownerFirstname;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $ownerLastname;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $urlWebsite;
/**
* @ORM\OneToMany(targetEntity=User::class, mappedBy="company")
*/
private $employees;
public function __construct()
{
$this->employees = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function getContact(): ?string
{
return $this->contact;
}
public function setContact(?string $contact): self
{
$this->contact = $contact;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getOwnerFirstname(): ?string
{
return $this->ownerFirstname;
}
public function setOwnerFirstname(?string $ownerFirstname): self
{
$this->ownerFirstname = $ownerFirstname;
return $this;
}
public function getOwnerLastname(): ?string
{
return $this->ownerLastname;
}
public function setOwnerLastname(?string $ownerLastname): self
{
$this->ownerLastname = $ownerLastname;
return $this;
}
public function getUrlWebsite(): ?string
{
return $this->urlWebsite;
}
public function setUrlWebsite(?string $urlWebsite): self
{
$this->urlWebsite = $urlWebsite;
return $this;
}
/**
* @return Collection<int, User>
*/
public function getEmployees(): Collection
{
return $this->employees;
}
public function addEmployee(User $employee): self
{
if (!$this->employees->contains($employee)) {
$this->employees[] = $employee;
$employee->setCompany($this);
}
return $this;
}
public function removeEmployee(User $employee): self
{
if ($this->employees->removeElement($employee)) {
// set the owning side to null (unless already changed)
if ($employee->getCompany() === $this) {
$employee->setCompany(null);
}
}
return $this;
}
}