src/Entity/ProjectOwner.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProjectOwnerRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ProjectOwnerRepository::class)
  10.  */
  11. class ProjectOwner
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      * @Groups({
  18.      *     "project.owner",
  19.      *     "project.list.with.necessary.details",
  20.      *
  21.      *     "project.details"
  22.      * })
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\Column(type="string", length=255)
  27.      * @Groups({
  28.      *     "project.owner",
  29.      *     "project.list.with.necessary.details",
  30.      *
  31.      *     "project.details"
  32.      *     })
  33.      */
  34.     private $company;
  35.     /**
  36.      * @ORM\ManyToOne(targetEntity=Countries::class, inversedBy="projectOwners")
  37.      * @Groups({"project.owner"})
  38.      */
  39.     private $country;
  40.     /**
  41.      * @ORM\Column(type="string", length=255, nullable=true)
  42.      * @Groups({
  43.      *      "project.owner",
  44.      *      "project.details",
  45.      * })
  46.      */
  47.     private $city;
  48.     /**
  49.      * @ORM\OneToMany(targetEntity=Projects::class, mappedBy="owner")
  50.      */
  51.     private $projects;
  52.     /**
  53.      * @ORM\OneToMany(targetEntity=ProjectOwnerContactPersons::class, mappedBy="project_owner", orphanRemoval=true, cascade={"persist", "remove"})
  54.      * @Groups({
  55.      *     "project.details"
  56.      * })
  57.      */
  58.     private $project_owner_contact_persons;
  59.     public function __construct()
  60.     {
  61.         $this->projects = new ArrayCollection();
  62.         $this->project_owner_contact_persons = new ArrayCollection();
  63.     }
  64.     public function getId(): ?int
  65.     {
  66.         return $this->id;
  67.     }
  68.     public function getCompany(): ?string
  69.     {
  70.         return $this->company;
  71.     }
  72.     public function setCompany(string $company): self
  73.     {
  74.         $this->company $company;
  75.         return $this;
  76.     }
  77.     public function getCountry(): ?Countries
  78.     {
  79.         return $this->country;
  80.     }
  81.     public function setCountry(?Countries $country): self
  82.     {
  83.         $this->country $country;
  84.         return $this;
  85.     }
  86.     public function getCity(): ?string
  87.     {
  88.         return $this->city;
  89.     }
  90.     public function setCity(?string $city): self
  91.     {
  92.         $this->city $city;
  93.         return $this;
  94.     }
  95.     /**
  96.      * @return Collection<int, Projects>
  97.      */
  98.     public function getProjects(): Collection
  99.     {
  100.         return $this->projects;
  101.     }
  102.     public function addProject(Projects $project): self
  103.     {
  104.         if (!$this->projects->contains($project)) {
  105.             $this->projects[] = $project;
  106.             $project->setOwner($this);
  107.         }
  108.         return $this;
  109.     }
  110.     public function removeProject(Projects $project): self
  111.     {
  112.         if ($this->projects->removeElement($project)) {
  113.             // set the owning side to null (unless already changed)
  114.             if ($project->getOwner() === $this) {
  115.                 $project->setOwner(null);
  116.             }
  117.         }
  118.         return $this;
  119.     }
  120.     /**
  121.      * @return Collection<int, ProjectOwnerContactPersons>
  122.      */
  123.     public function getProjectOwnerContactPersons(): Collection
  124.     {
  125.         return $this->project_owner_contact_persons;
  126.     }
  127.     public function addProjectOwnerContactPerson(ProjectOwnerContactPersons $projectOwnerContactPerson): self
  128.     {
  129.         if (!$this->project_owner_contact_persons->contains($projectOwnerContactPerson)) {
  130.             $this->project_owner_contact_persons[] = $projectOwnerContactPerson;
  131.             $projectOwnerContactPerson->setProjectOwner($this);
  132.         }
  133.         return $this;
  134.     }
  135.     public function removeProjectOwnerContactPerson(ProjectOwnerContactPersons $projectOwnerContactPerson): self
  136.     {
  137.         if ($this->project_owner_contact_persons->removeElement($projectOwnerContactPerson)) {
  138.             // set the owning side to null (unless already changed)
  139.             if ($projectOwnerContactPerson->getProjectOwner() === $this) {
  140.                 $projectOwnerContactPerson->setProjectOwner(null);
  141.             }
  142.         }
  143.         return $this;
  144.     }
  145. }