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("partner")
  18.      * @Groups({
  19.      *     "country.base",
  20.      *     "counties.basic",
  21.      *     "project.branches",
  22.      *     "project.owner",
  23.      *     "project.base",
  24.      *     "countries.base",
  25.      *     "partner.list.base",
  26.      *     "partner.manage.base",
  27.      *     "branch.location.base",
  28.      *
  29.      *     "country.core",
  30.      *
  31.      *
  32.      *     "country@core"
  33.      * })
  34.      *
  35.      */
  36.     private $id;
  37.     /**
  38.      * @ORM\Column(type="string", length=255)
  39.      * @Groups({
  40.      *     "counties.basic",
  41.      *     "project.branches",
  42.      *     "project.owner",
  43.     *      "project.base",
  44.      *     "countries.base",
  45.      *     "partner.list.base",
  46.      *     "partner.manage.base",
  47.      *     "branch.location.base",
  48.      *     "project.list.with.necessary.details",
  49.      *
  50.      *     "project.details",
  51.      *
  52.      *     "country.base",
  53.      *
  54.      *     "country.core",
  55.      *
  56.      *     "country@core"
  57.      * })
  58.      */
  59.     private $name;
  60.     /**
  61.      * @ORM\Column(type="string", length=5)
  62.      * @Groups({
  63.      *     "country@core"
  64.      * })
  65.      */
  66.     private $iso_code;
  67.     /**
  68.      * @ORM\OneToMany(targetEntity=ProjectOwner::class, mappedBy="country")
  69.      */
  70.     private $projectOwners;
  71.     /**
  72.      * @ORM\OneToMany(targetEntity=Projects::class, mappedBy="country")
  73.      */
  74.     private $projects;
  75.     /**
  76.      * @ORM\OneToMany(targetEntity=Addresses::class, mappedBy="country")
  77.      */
  78.     private $addresses;
  79.     /**
  80.      * @ORM\OneToMany(targetEntity=Vendor::class, mappedBy="country")
  81.      */
  82.     private $vendors;
  83.     public function __construct()
  84.     {
  85.         $this->partners = new ArrayCollection();
  86.         $this->projectOwners = new ArrayCollection();
  87.         $this->projects = new ArrayCollection();
  88.         $this->addresses = new ArrayCollection();
  89.         $this->vendors = new ArrayCollection();
  90.     }
  91.     public function getId(): ?int
  92.     {
  93.         return $this->id;
  94.     }
  95.     public function getName(): ?string
  96.     {
  97.         return $this->name;
  98.     }
  99.     public function setName(string $name): self
  100.     {
  101.         $this->name $name;
  102.         return $this;
  103.     }
  104.     public function getIsoCode(): ?string
  105.     {
  106.         return $this->iso_code;
  107.     }
  108.     public function setIsoCode(string $iso_code): self
  109.     {
  110.         $this->iso_code $iso_code;
  111.         return $this;
  112.     }
  113.     /**
  114.      * @return Collection<int, ProjectOwner>
  115.      */
  116.     public function getProjectOwners(): Collection
  117.     {
  118.         return $this->projectOwners;
  119.     }
  120.     public function addProjectOwner(ProjectOwner $projectOwner): self
  121.     {
  122.         if (!$this->projectOwners->contains($projectOwner)) {
  123.             $this->projectOwners[] = $projectOwner;
  124.             $projectOwner->setCountry($this);
  125.         }
  126.         return $this;
  127.     }
  128.     public function removeProjectOwner(ProjectOwner $projectOwner): self
  129.     {
  130.         if ($this->projectOwners->removeElement($projectOwner)) {
  131.             // set the owning side to null (unless already changed)
  132.             if ($projectOwner->getCountry() === $this) {
  133.                 $projectOwner->setCountry(null);
  134.             }
  135.         }
  136.         return $this;
  137.     }
  138.     /**
  139.      * @return Collection<int, Projects>
  140.      */
  141.     public function getProjects(): Collection
  142.     {
  143.         return $this->projects;
  144.     }
  145.     public function addProject(Projects $project): self
  146.     {
  147.         if (!$this->projects->contains($project)) {
  148.             $this->projects[] = $project;
  149.             $project->setCountry($this);
  150.         }
  151.         return $this;
  152.     }
  153.     public function removeProject(Projects $project): self
  154.     {
  155.         if ($this->projects->removeElement($project)) {
  156.             // set the owning side to null (unless already changed)
  157.             if ($project->getCountry() === $this) {
  158.                 $project->setCountry(null);
  159.             }
  160.         }
  161.         return $this;
  162.     }
  163.     /**
  164.      * @return Collection<int, Addresses>
  165.      */
  166.     public function getAddresses(): Collection
  167.     {
  168.         return $this->addresses;
  169.     }
  170.     public function addAdress(Addresses $adress): self
  171.     {
  172.         if (!$this->addresses->contains($adress)) {
  173.             $this->addresses[] = $adress;
  174.             $adress->setCountry($this);
  175.         }
  176.         return $this;
  177.     }
  178.     public function removeAdress(Addresses $adress): self
  179.     {
  180.         if ($this->addresses->removeElement($adress)) {
  181.             // set the owning side to null (unless already changed)
  182.             if ($adress->getCountry() === $this) {
  183.                 $adress->setCountry(null);
  184.             }
  185.         }
  186.         return $this;
  187.     }
  188.     /**
  189.      * @return Collection<int, Vendor>
  190.      */
  191.     public function getVendors(): Collection
  192.     {
  193.         return $this->vendors;
  194.     }
  195.     public function addVendor(Vendor $vendor): self
  196.     {
  197.         if (!$this->vendors->contains($vendor)) {
  198.             $this->vendors[] = $vendor;
  199.             $vendor->setCountry($this);
  200.         }
  201.         return $this;
  202.     }
  203.     public function removeVendor(Vendor $vendor): self
  204.     {
  205.         if ($this->vendors->removeElement($vendor)) {
  206.             // set the owning side to null (unless already changed)
  207.             if ($vendor->getCountry() === $this) {
  208.                 $vendor->setCountry(null);
  209.             }
  210.         }
  211.         return $this;
  212.     }
  213. }