src/Entity/Countries.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CountriesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=CountriesRepository::class)
  10.  */
  11. class Countries
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      * Groups("customer")
  18.      * @Groups({
  19.      *     "country.base",
  20.      *     "counties.basic",
  21.      *     "project.branches",
  22.      *     "project.owner",
  23.      *     "project.base",
  24.      *     "countries.base",
  25.      *     "customer.list.base",
  26.      *     "customer.manage.base",
  27.      *     "branch.location.base",
  28.      *
  29.      *     "country.core"
  30.      * })
  31.      *
  32.      */
  33.     private $id;
  34.     /**
  35.      * @ORM\Column(type="string", length=255)
  36.      * @Groups({
  37.      *     "counties.basic",
  38.      *     "project.branches",
  39.      *     "project.owner",
  40.     *      "project.base",
  41.      *     "countries.base",
  42.      *     "customer.list.base",
  43.      *     "customer.manage.base",
  44.      *     "branch.location.base",
  45.      *     "project.list.with.necessary.details",
  46.      *
  47.      *     "project.details",
  48.      *
  49.      *     "country.base",
  50.      *
  51.      *     "country.core"
  52.      * })
  53.      */
  54.     private $name;
  55.     /**
  56.      * @ORM\Column(type="string", length=5)
  57.      */
  58.     private $iso_code;
  59.     /**
  60.      * @ORM\OneToMany(targetEntity=ProjectOwner::class, mappedBy="country")
  61.      */
  62.     private $projectOwners;
  63.     /**
  64.      * @ORM\OneToMany(targetEntity=Projects::class, mappedBy="country")
  65.      */
  66.     private $projects;
  67.     /**
  68.      * @ORM\OneToMany(targetEntity=Addresses::class, mappedBy="country")
  69.      */
  70.     private $addresses;
  71.     public function __construct()
  72.     {
  73.         $this->customers = new ArrayCollection();
  74.         $this->projectOwners = new ArrayCollection();
  75.         $this->projects = new ArrayCollection();
  76.         $this->addresses = new ArrayCollection();
  77.     }
  78.     public function getId(): ?int
  79.     {
  80.         return $this->id;
  81.     }
  82.     public function getName(): ?string
  83.     {
  84.         return $this->name;
  85.     }
  86.     public function setName(string $name): self
  87.     {
  88.         $this->name $name;
  89.         return $this;
  90.     }
  91.     public function getIsoCode(): ?string
  92.     {
  93.         return $this->iso_code;
  94.     }
  95.     public function setIsoCode(string $iso_code): self
  96.     {
  97.         $this->iso_code $iso_code;
  98.         return $this;
  99.     }
  100.     /**
  101.      * @return Collection<int, ProjectOwner>
  102.      */
  103.     public function getProjectOwners(): Collection
  104.     {
  105.         return $this->projectOwners;
  106.     }
  107.     public function addProjectOwner(ProjectOwner $projectOwner): self
  108.     {
  109.         if (!$this->projectOwners->contains($projectOwner)) {
  110.             $this->projectOwners[] = $projectOwner;
  111.             $projectOwner->setCountry($this);
  112.         }
  113.         return $this;
  114.     }
  115.     public function removeProjectOwner(ProjectOwner $projectOwner): self
  116.     {
  117.         if ($this->projectOwners->removeElement($projectOwner)) {
  118.             // set the owning side to null (unless already changed)
  119.             if ($projectOwner->getCountry() === $this) {
  120.                 $projectOwner->setCountry(null);
  121.             }
  122.         }
  123.         return $this;
  124.     }
  125.     /**
  126.      * @return Collection<int, Projects>
  127.      */
  128.     public function getProjects(): Collection
  129.     {
  130.         return $this->projects;
  131.     }
  132.     public function addProject(Projects $project): self
  133.     {
  134.         if (!$this->projects->contains($project)) {
  135.             $this->projects[] = $project;
  136.             $project->setCountry($this);
  137.         }
  138.         return $this;
  139.     }
  140.     public function removeProject(Projects $project): self
  141.     {
  142.         if ($this->projects->removeElement($project)) {
  143.             // set the owning side to null (unless already changed)
  144.             if ($project->getCountry() === $this) {
  145.                 $project->setCountry(null);
  146.             }
  147.         }
  148.         return $this;
  149.     }
  150.     /**
  151.      * @return Collection<int, Addresses>
  152.      */
  153.     public function getAddresses(): Collection
  154.     {
  155.         return $this->addresses;
  156.     }
  157.     public function addAdress(Addresses $adress): self
  158.     {
  159.         if (!$this->addresses->contains($adress)) {
  160.             $this->addresses[] = $adress;
  161.             $adress->setCountry($this);
  162.         }
  163.         return $this;
  164.     }
  165.     public function removeAdress(Addresses $adress): self
  166.     {
  167.         if ($this->addresses->removeElement($adress)) {
  168.             // set the owning side to null (unless already changed)
  169.             if ($adress->getCountry() === $this) {
  170.                 $adress->setCountry(null);
  171.             }
  172.         }
  173.         return $this;
  174.     }
  175. }