<?php
namespace App\Entity;
use App\Repository\ProjectOwnerRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=ProjectOwnerRepository::class)
*/
class ProjectOwner
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "project.owner",
* "project.list.with.necessary.details",
*
* "project.details"
* })
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Groups({
* "project.owner",
* "project.list.with.necessary.details",
*
* "project.details"
* })
*/
private $company;
/**
* @ORM\ManyToOne(targetEntity=Countries::class, inversedBy="projectOwners")
* @Groups({"project.owner"})
*/
private $country;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({
* "project.owner",
* "project.details",
* })
*/
private $city;
/**
* @ORM\OneToMany(targetEntity=Projects::class, mappedBy="owner")
*/
private $projects;
/**
* @ORM\OneToMany(targetEntity=ProjectOwnerContactPersons::class, mappedBy="project_owner", orphanRemoval=true, cascade={"persist", "remove"})
* @Groups({
* "project.details"
* })
*/
private $project_owner_contact_persons;
public function __construct()
{
$this->projects = new ArrayCollection();
$this->project_owner_contact_persons = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getCompany(): ?string
{
return $this->company;
}
public function setCompany(string $company): self
{
$this->company = $company;
return $this;
}
public function getCountry(): ?Countries
{
return $this->country;
}
public function setCountry(?Countries $country): self
{
$this->country = $country;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
/**
* @return Collection<int, Projects>
*/
public function getProjects(): Collection
{
return $this->projects;
}
public function addProject(Projects $project): self
{
if (!$this->projects->contains($project)) {
$this->projects[] = $project;
$project->setOwner($this);
}
return $this;
}
public function removeProject(Projects $project): self
{
if ($this->projects->removeElement($project)) {
// set the owning side to null (unless already changed)
if ($project->getOwner() === $this) {
$project->setOwner(null);
}
}
return $this;
}
/**
* @return Collection<int, ProjectOwnerContactPersons>
*/
public function getProjectOwnerContactPersons(): Collection
{
return $this->project_owner_contact_persons;
}
public function addProjectOwnerContactPerson(ProjectOwnerContactPersons $projectOwnerContactPerson): self
{
if (!$this->project_owner_contact_persons->contains($projectOwnerContactPerson)) {
$this->project_owner_contact_persons[] = $projectOwnerContactPerson;
$projectOwnerContactPerson->setProjectOwner($this);
}
return $this;
}
public function removeProjectOwnerContactPerson(ProjectOwnerContactPersons $projectOwnerContactPerson): self
{
if ($this->project_owner_contact_persons->removeElement($projectOwnerContactPerson)) {
// set the owning side to null (unless already changed)
if ($projectOwnerContactPerson->getProjectOwner() === $this) {
$projectOwnerContactPerson->setProjectOwner(null);
}
}
return $this;
}
}