src/Entity/JobsLib.php line 27

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\JobsLibRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use ApiPlatform\Metadata\ApiFilter;
  10. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. use Symfony\Component\Serializer\Annotation\MaxDepth;
  13. use ApiPlatform\Core\Annotation\ApiProperty;
  14. #[ORM\Entity(repositoryClassJobsLibRepository::class)]
  15. #[ApiResource(
  16.     normalizationContext: ['groups' => ['job_lib:read']],
  17.     denormalizationContext: ['groups' => ['job_lib:write']],
  18.     order: ['id' => 'DESC'],
  19. )]
  20. #[ApiFilter(SearchFilter::class, properties: [
  21.     'name' => 'ipartial'
  22.     'code1c' => 'exact'
  23. ])]
  24. class JobsLib
  25. {
  26.     #[Groups(['job_lib:read''job_lib:write','job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write'])]
  27.     #[ORM\Id]
  28.     #[ORM\GeneratedValue]
  29.     #[ORM\Column]
  30.     private ?int $id null;
  31.     #[Groups(['job_lib:read''job_lib:write','job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write'])]
  32.     #[ORM\Column(length255nullabletrue)]
  33.     private ?string $name null;
  34.     #[Groups(['job_lib:read''job_lib:write','job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write'])]
  35.     #[ORM\Column(length255nullabletrue)]
  36.     private ?string $description null;
  37.     #[Groups(['job_lib:read''job_lib:write','job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write'])]
  38.     #[ORM\Column(length100nullabletrue)]
  39.     private ?string $code1c null;
  40.     #[Groups(['job_lib:read''job_lib:write','job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write'])]
  41.     #[ORM\ManyToMany(targetEntityAccountJobsList::class, inversedBy'jobsLibs')]
  42.     private Collection $accountJobsList;
  43.     public function __construct()
  44.     {
  45.         $this->accountJobsList = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getName(): ?string
  52.     {
  53.         return $this->name;
  54.     }
  55.     public function setName(?string $name): self
  56.     {
  57.         $this->name $name;
  58.         return $this;
  59.     }
  60.     public function getDescription(): ?string
  61.     {
  62.         return $this->description;
  63.     }
  64.     public function setDescription(?string $description): self
  65.     {
  66.         $this->description $description;
  67.         return $this;
  68.     }
  69.     public function getCode1c(): ?string
  70.     {
  71.         return $this->code1c;
  72.     }
  73.     public function setCode1c(?string $code1c): self
  74.     {
  75.         $this->code1c $code1c;
  76.         return $this;
  77.     }
  78.     /**
  79.      * @return Collection<int, AccountJobsList>
  80.      */
  81.     public function getAccountJobsList(): Collection
  82.     {
  83.         return $this->accountJobsList;
  84.     }
  85.     public function addAccountJobsList(AccountJobsList $accountJobsList): self
  86.     {
  87.         if (!$this->accountJobsList->contains($accountJobsList)) {
  88.             $this->accountJobsList->add($accountJobsList);
  89.         }
  90.         return $this;
  91.     }
  92.     public function removeAccountJobsList(AccountJobsList $accountJobsList): self
  93.     {
  94.         $this->accountJobsList->removeElement($accountJobsList);
  95.         return $this;
  96.     }
  97. }