src/Entity/AccountJobsList.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\AccountJobsListRepository;
  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 Symfony\Component\Serializer\Annotation\Groups;
  10. use ApiPlatform\Metadata\ApiFilter;
  11. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  12. #[ORM\Entity(repositoryClassAccountJobsListRepository::class)]
  13. #[ApiResource(
  14.     normalizationContext: ['groups' => ['account_job:read']],
  15.     denormalizationContext: ['groups' => ['account_job:write']],
  16.     order: ['id' => 'DESC'],
  17. )]
  18. #[ApiFilter(SearchFilter::class, properties: [
  19.     'name' => 'ipartial'
  20.     'account.id' => 'exact'
  21.     'status' => 'exact'
  22. ])]
  23. class AccountJobsList
  24. {
  25.     #[Groups(['account_job:write''account_job:read''account:read''agreements:read''user:read''job:read''worker:read'])]
  26.     #[ORM\Id]
  27.     #[ORM\GeneratedValue]
  28.     #[ORM\Column]
  29.     private ?int $id null;
  30.     #[Groups(['account_job:write''account_job:read''account:read''agreements:read''user:read''job:read''worker:read'])]
  31.     #[ORM\Column(length255)]
  32.     private ?string $name null;
  33.     #[Groups(['account_job:write''account_job:read''account:read''agreements:read''user:read''job:read''worker:read'])]
  34.     #[ORM\Column(length100nullabletrue)]
  35.     private ?string $status null;
  36.     
  37.     #[Groups(['account_job:write''account_job:read''account:read''agreements:read''user:read''job:read''worker:read'])]
  38.     #[ORM\ManyToOne(inversedBy'accountJobsLists')]
  39.     private ?MediaObject $document null;
  40.     #[Groups(['account_job:write''account_job:read''job:read''worker:read'])]
  41.     #[ORM\ManyToOne(inversedBy'accountJobsLists')]
  42.     private ?Accounts $account null;
  43.     #[Groups(['account_job:write''account_job:read''account:read''agreements:read''user:read''job:read''worker:read'])]
  44.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  45.     private ?\DateTimeInterface $dateEnd null;
  46.     #[Groups(['account_job:write''account_job:read''account:read''agreements:read''user:read''worker:read'])]
  47.     #[ORM\ManyToMany(targetEntityJobs::class, mappedBy'AccountJobsList')]
  48.     private Collection $jobs;
  49.     #[Groups(['account_job:write''account_job:read''account:read''agreements:read''user:read''worker:read'])]
  50.     #[ORM\ManyToMany(targetEntityJobsLib::class, mappedBy'accountJobsList')]
  51.     private Collection $jobsLibs;
  52.     public function __construct()
  53.     {
  54.         // $this->mediaObjects = new ArrayCollection();
  55.         $this->jobs = new ArrayCollection();
  56.         $this->jobsLibs = new ArrayCollection();
  57.     }
  58.     public function getId(): ?int
  59.     {
  60.         return $this->id;
  61.     }
  62.     public function getName(): ?string
  63.     {
  64.         return $this->name;
  65.     }
  66.     public function setName(string $name): self
  67.     {
  68.         $this->name $name;
  69.         return $this;
  70.     }
  71.     public function getStatus(): ?string
  72.     {
  73.         return $this->status;
  74.     }
  75.     public function setStatus(?string $status): self
  76.     {
  77.         $this->status $status;
  78.         return $this;
  79.     }
  80.     public function getDocument(): ?MediaObject
  81.     {
  82.         return $this->document;
  83.     }
  84.     public function setDocument(?MediaObject $document): self
  85.     {
  86.         $this->document $document;
  87.         return $this;
  88.     }
  89.     public function getAccount(): ?Accounts
  90.     {
  91.         return $this->account;
  92.     }
  93.     public function setAccount(?Accounts $account): self
  94.     {
  95.         $this->account $account;
  96.         return $this;
  97.     }
  98.     public function getDateEnd(): ?\DateTimeInterface
  99.     {
  100.         return $this->dateEnd;
  101.     }
  102.     public function setDateEnd(?\DateTimeInterface $dateEnd): self
  103.     {
  104.         $this->dateEnd $dateEnd;
  105.         return $this;
  106.     }
  107.     /**
  108.      * @return Collection<int, Jobs>
  109.      */
  110.     public function getJobs(): Collection
  111.     {
  112.         return $this->jobs;
  113.     }
  114.     public function addJob(Jobs $job): self
  115.     {
  116.         if (!$this->jobs->contains($job)) {
  117.             $this->jobs->add($job);
  118.             $job->addAccountJobsList($this);
  119.         }
  120.         return $this;
  121.     }
  122.     public function removeJob(Jobs $job): self
  123.     {
  124.         if ($this->jobs->removeElement($job)) {
  125.             $job->removeAccountJobsList($this);
  126.         }
  127.         return $this;
  128.     }
  129.     /**
  130.      * @return Collection<int, JobsLib>
  131.      */
  132.     public function getJobsLibs(): Collection
  133.     {
  134.         return $this->jobsLibs;
  135.     }
  136.     public function addJobsLib(JobsLib $jobsLib): self
  137.     {
  138.         if (!$this->jobsLibs->contains($jobsLib)) {
  139.             $this->jobsLibs->add($jobsLib);
  140.             $jobsLib->addAccountJobsList($this);
  141.         }
  142.         return $this;
  143.     }
  144.     public function removeJobsLib(JobsLib $jobsLib): self
  145.     {
  146.         if ($this->jobsLibs->removeElement($jobsLib)) {
  147.             $jobsLib->removeAccountJobsList($this);
  148.         }
  149.         return $this;
  150.     }
  151. }