src/Entity/Company.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CompanyRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CompanyRepository::class)
  9.  */
  10. class Company
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private $address;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $contact;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $email;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $ownerFirstname;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private $ownerLastname;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      */
  45.     private $urlWebsite;
  46.     /**
  47.      * @ORM\OneToMany(targetEntity=User::class, mappedBy="company")
  48.      */
  49.     private $employees;
  50.     public function __construct()
  51.     {
  52.         $this->employees = new ArrayCollection();
  53.     }
  54.     public function getId(): ?int
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getName(): ?string
  59.     {
  60.         return $this->name;
  61.     }
  62.     public function setName(string $name): self
  63.     {
  64.         $this->name $name;
  65.         return $this;
  66.     }
  67.     public function getAddress(): ?string
  68.     {
  69.         return $this->address;
  70.     }
  71.     public function setAddress(?string $address): self
  72.     {
  73.         $this->address $address;
  74.         return $this;
  75.     }
  76.     public function getContact(): ?string
  77.     {
  78.         return $this->contact;
  79.     }
  80.     public function setContact(?string $contact): self
  81.     {
  82.         $this->contact $contact;
  83.         return $this;
  84.     }
  85.     public function getEmail(): ?string
  86.     {
  87.         return $this->email;
  88.     }
  89.     public function setEmail(?string $email): self
  90.     {
  91.         $this->email $email;
  92.         return $this;
  93.     }
  94.     public function getOwnerFirstname(): ?string
  95.     {
  96.         return $this->ownerFirstname;
  97.     }
  98.     public function setOwnerFirstname(?string $ownerFirstname): self
  99.     {
  100.         $this->ownerFirstname $ownerFirstname;
  101.         return $this;
  102.     }
  103.     public function getOwnerLastname(): ?string
  104.     {
  105.         return $this->ownerLastname;
  106.     }
  107.     public function setOwnerLastname(?string $ownerLastname): self
  108.     {
  109.         $this->ownerLastname $ownerLastname;
  110.         return $this;
  111.     }
  112.     public function getUrlWebsite(): ?string
  113.     {
  114.         return $this->urlWebsite;
  115.     }
  116.     public function setUrlWebsite(?string $urlWebsite): self
  117.     {
  118.         $this->urlWebsite $urlWebsite;
  119.         return $this;
  120.     }
  121.     /**
  122.      * @return Collection<int, User>
  123.      */
  124.     public function getEmployees(): Collection
  125.     {
  126.         return $this->employees;
  127.     }
  128.     public function addEmployee(User $employee): self
  129.     {
  130.         if (!$this->employees->contains($employee)) {
  131.             $this->employees[] = $employee;
  132.             $employee->setCompany($this);
  133.         }
  134.         return $this;
  135.     }
  136.     public function removeEmployee(User $employee): self
  137.     {
  138.         if ($this->employees->removeElement($employee)) {
  139.             // set the owning side to null (unless already changed)
  140.             if ($employee->getCompany() === $this) {
  141.                 $employee->setCompany(null);
  142.             }
  143.         }
  144.         return $this;
  145.     }
  146. }