src/Evo/Infrastructure/MappingORM/ActivitySubdomain.php line 31

Open in your IDE?
  1. <?php
  2. namespace Evo\Infrastructure\MappingORM;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  6. use App\Repository\ActivitySubdomainRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. /**
  12.  * @ApiResource(
  13.  *     denormalizationContext={"groups"={"write_activity_subdomain"}},
  14.  *     normalizationContext={"groups"={"read_activity_subdomain", "read_activity_two"}, "enable_max_depth"=true},
  15.  *     collectionOperations={
  16.  *         "get",
  17.  *         "post",
  18.  *         "activity_subdomain_all"={
  19.  *             "method"="GET",
  20.  *             "path"="/activity_subdomains/all"
  21.  *         }
  22.  *     },
  23.  *     itemOperations={"get", "put"}
  24.  * )
  25.  * @ApiFilter(SearchFilter::class, properties={"activityDomain.id":"exact", "label": "partial", "code": "partial"})
  26.  * @ORM\Entity(repositoryClass=ActivitySubdomainRepository::class)
  27.  */
  28. class ActivitySubdomain
  29. {
  30.     /**
  31.      * @Groups({"write_activity_subdomain", "read_activity_subdomain", "read_activity_one", "read_activity_two"})
  32.      * @ORM\Id
  33.      * @ORM\GeneratedValue
  34.      * @ORM\Column(type="integer")
  35.      */
  36.     private ?int $id null;
  37.     /**
  38.      * @Groups({"write_activity_subdomain", "read_activity_subdomain", "read_activity_one", "read_activity_two"})
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private ?string $label null;
  42.     /**
  43.      * @Groups({"write_activity_subdomain", "read_activity_subdomain", "read_activity_one", "read_activity_two"})
  44.      * @ORM\Column(type="string", length=255, nullable=true)
  45.      */
  46.     private ?string $code null;
  47.     /**
  48.      * @Groups({"write_activity_subdomain", "read_activity_subdomain"})
  49.      * @ORM\ManyToOne(targetEntity=ActivityDomain::class, inversedBy="actFieldDetails")
  50.      */
  51.     private ?ActivityDomain $activityDomain null;
  52.     /**
  53.      * @Groups({"write_activity_subdomain", "read_activity_subdomain", "read_activity_two"})
  54.      * @ORM\OneToMany(targetEntity=ProfessionType::class, mappedBy="activitySubdomain")
  55.      */
  56.     private ?Collection $professionTypes;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      */
  60.     private ?string $finalCode null;
  61.     public function __construct()
  62.     {
  63.         $this->professionTypes = new ArrayCollection();
  64.     }
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getLabel(): ?string
  70.     {
  71.         return $this->label;
  72.     }
  73.     public function setLabel(?string $label): self
  74.     {
  75.         $this->label $label;
  76.         return $this;
  77.     }
  78.     public function getCode(): ?string
  79.     {
  80.         return $this->code;
  81.     }
  82.     public function setCode(?string $code): self
  83.     {
  84.         $this->code $code;
  85.         return $this;
  86.     }
  87.     public function getActivityDomain(): ?ActivityDomain
  88.     {
  89.         return $this->activityDomain;
  90.     }
  91.     public function setActivityDomain(?ActivityDomain $activityDomain): self
  92.     {
  93.         $this->activityDomain $activityDomain;
  94.         return $this;
  95.     }
  96.     /**
  97.      * @return Collection<int, ProfessionType>
  98.      */
  99.     public function getProfessionTypes(): Collection
  100.     {
  101.         return $this->professionTypes;
  102.     }
  103.     public function addProfessionType(ProfessionType $professionType): self
  104.     {
  105.         if (!$this->professionTypes->contains($professionType)) {
  106.             $this->professionTypes[] = $professionType;
  107.             $professionType->setActivitySubdomain($this);
  108.         }
  109.         return $this;
  110.     }
  111.     public function removeProfessionType(ProfessionType $professionType): self
  112.     {
  113.         // set the owning side to null (unless already changed)
  114.         if ($this->professionTypes->removeElement($professionType) && $professionType->getActivitySubdomain() === $this) {
  115.             $professionType->setActivitySubdomain(null);
  116.         }
  117.         return $this;
  118.     }
  119.     public function getFinalCode(): ?string
  120.     {
  121.         return $this->finalCode;
  122.     }
  123.     public function setFinalCode(?string $finalCode): self
  124.     {
  125.         $this->finalCode $finalCode;
  126.         return $this;
  127.     }
  128. }