src/Entity/Jobs.php line 33

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\JobsRepository;
  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(repositoryClassJobsRepository::class)]
  15. #[ApiResource(
  16.     normalizationContext: ['groups' => ['job:read']],
  17.     denormalizationContext: ['groups' => ['job:write']],
  18.     order: ['id' => 'DESC'],
  19. )]
  20. #[ApiFilter(SearchFilter::class, properties: [
  21.     'name' => 'ipartial'
  22.     'code1c' => 'exact'
  23.     'email' => 'exact'
  24.     'status' => 'exact'
  25.     'account.user.id' => 'exact'
  26.     'account.id' => 'exact'
  27.     'account.name' => 'ipartial',
  28.     'factory.id' => 'exact'
  29. ])]
  30. class Jobs
  31. {
  32.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  33.     #[ORM\Id]
  34.     #[ORM\GeneratedValue]
  35.     #[ORM\Column]
  36.     private ?int $id null;
  37.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  38.     #[ORM\Column(length255nullabletrue)]
  39.     private ?string $name null;
  40.     #[Groups(['job:read''job:write''worker:read''worker:write'])]
  41.     #[ORM\ManyToOne(inversedBy'jobs')]
  42.     private ?Accounts $account null;
  43.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  44.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  45.     private ?string $description null;
  46.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  47.     #[ORM\Column(length100nullabletrue)]
  48.     private ?string $code1c null;
  49.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  50.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  51.     private ?\DateTimeInterface $dateEntered null;
  52.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  53.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  54.     private ?\DateTimeInterface $date null;
  55.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  56.     #[ORM\OneToMany(mappedBy'job'targetEntityJobWorker::class)]
  57.     private Collection $jobWorkers;
  58.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  59.     #[ORM\OneToMany(mappedBy'job'targetEntityMediaObject::class)]
  60.     private Collection $mediaObjects;
  61.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  62.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  63.     private ?\DateTimeInterface $dateStart null;
  64.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  65.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  66.     private ?\DateTimeInterface $dateEnd null;
  67.     // #[Groups(['job:read', 'job:write', 'worker:read', 'worker:write', 'account_worker:read', 'account:read', 'read', 'account:write' ])]
  68.     // #[ORM\ManyToMany(targetEntity: JobsLib::class, mappedBy: 'jobs')]
  69.     // private Collection $jobsLibs;
  70.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  71.     #[ORM\ManyToMany(targetEntityAccountJobsList::class, inversedBy'jobs')]
  72.     private Collection $AccountJobsList;
  73.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  74.     #[ORM\Column(length100nullabletrue)]
  75.     private ?string $status null;
  76.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  77.     #[ORM\ManyToOne(inversedBy'commandment_jobs'cascade:['persist'])]
  78.     private ?MediaObject $commandment null;
  79.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  80.     #[ORM\ManyToOne(inversedBy'graph_jobs'cascade:['persist'])]
  81.     private ?MediaObject $graph null;
  82.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  83.     #[ORM\ManyToOne(inversedBy'protocole_jobs'cascade:['persist']
  84.     )]
  85.     private ?MediaObject $protocole null;
  86.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  87.     #[ORM\ManyToOne(inversedBy'jobs')]
  88.     private ?Engineer $engineer null;
  89.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  90.     #[ORM\ManyToOne(inversedBy'jobs')]
  91.     private ?Factory $factory null;
  92.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  93.     #[ORM\Column(length255nullabletrue)]
  94.     private ?string $comentar null;
  95.     public function __construct()
  96.     {
  97.         $this->jobWorkers = new ArrayCollection();
  98.         $this->mediaObjects = new ArrayCollection();
  99.         // $this->jobsLibs = new ArrayCollection();
  100.         $this->AccountJobsList = new ArrayCollection();
  101.     }
  102.     public function getId(): ?int
  103.     {
  104.         return $this->id;
  105.     }
  106.     public function getName(): ?string
  107.     {
  108.         return $this->name;
  109.     }
  110.     public function setName(?string $name): self
  111.     {
  112.         $this->name $name;
  113.         return $this;
  114.     }
  115.     public function getAccount(): ?Accounts
  116.     {
  117.         return $this->account;
  118.     }
  119.     public function setAccount(?Accounts $account): self
  120.     {
  121.         $this->account $account;
  122.         return $this;
  123.     }
  124.     public function getDescription(): ?string
  125.     {
  126.         return $this->description;
  127.     }
  128.     public function setDescription(?string $description): self
  129.     {
  130.         $this->description $description;
  131.         return $this;
  132.     }
  133.     public function getCode1c(): ?string
  134.     {
  135.         return $this->code1c;
  136.     }
  137.     public function setCode1c(?string $code1c): self
  138.     {
  139.         $this->code1c $code1c;
  140.         return $this;
  141.     }
  142.     public function getDateEntered(): ?\DateTimeInterface
  143.     {
  144.         return $this->dateEntered;
  145.     }
  146.     public function setDateEntered(?\DateTimeInterface $dateEntered): self
  147.     {
  148.         $this->dateEntered $dateEntered;
  149.         return $this;
  150.     }
  151.     public function getDate(): ?\DateTimeInterface
  152.     {
  153.         return $this->date;
  154.     }
  155.     public function setDate(?\DateTimeInterface $date): self
  156.     {
  157.         $this->date $date;
  158.         return $this;
  159.     }
  160.     /**
  161.      * @return Collection<int, JobWorker>
  162.      */
  163.     public function getJobWorkers(): Collection
  164.     {
  165.         return $this->jobWorkers;
  166.     }
  167.     public function addJobWorker(JobWorker $jobWorker): self
  168.     {
  169.         if (!$this->jobWorkers->contains($jobWorker)) {
  170.             $this->jobWorkers->add($jobWorker);
  171.             $jobWorker->setJob($this);
  172.         }
  173.         return $this;
  174.     }
  175.     public function removeJobWorker(JobWorker $jobWorker): self
  176.     {
  177.         if ($this->jobWorkers->removeElement($jobWorker)) {
  178.             // set the owning side to null (unless already changed)
  179.             if ($jobWorker->getJob() === $this) {
  180.                 $jobWorker->setJob(null);
  181.             }
  182.         }
  183.         return $this;
  184.     }
  185.     /**
  186.      * @return Collection<int, MediaObject>
  187.      */
  188.     public function getMediaObjects(): Collection
  189.     {
  190.         return $this->mediaObjects;
  191.     }
  192.     public function addMediaObject(MediaObject $mediaObject): self
  193.     {
  194.         if (!$this->mediaObjects->contains($mediaObject)) {
  195.             $this->mediaObjects->add($mediaObject);
  196.             $mediaObject->setJob($this);
  197.         }
  198.         return $this;
  199.     }
  200.     public function removeMediaObject(MediaObject $mediaObject): self
  201.     {
  202.         if ($this->mediaObjects->removeElement($mediaObject)) {
  203.             // set the owning side to null (unless already changed)
  204.             if ($mediaObject->getJob() === $this) {
  205.                 $mediaObject->setJob(null);
  206.             }
  207.         }
  208.         return $this;
  209.     }
  210.     public function getDateStart(): ?\DateTimeInterface
  211.     {
  212.         return $this->dateStart;
  213.     }
  214.     public function setDateStart(?\DateTimeInterface $dateStart): self
  215.     {
  216.         $this->dateStart $dateStart;
  217.         return $this;
  218.     }
  219.     public function getDateEnd(): ?\DateTimeInterface
  220.     {
  221.         return $this->dateEnd;
  222.     }
  223.     public function setDateEnd(?\DateTimeInterface $dateEnd): self
  224.     {
  225.         $this->dateEnd $dateEnd;
  226.         return $this;
  227.     }
  228.     // /**
  229.     //  * @return Collection<int, JobsLib>
  230.     //  */
  231.     // public function getJobsLibs(): Collection
  232.     // {
  233.     //     return $this->jobsLibs;
  234.     // }
  235.     // public function addJobsLib(JobsLib $jobsLib): self
  236.     // {
  237.     //     if (!$this->jobsLibs->contains($jobsLib)) {
  238.     //         $this->jobsLibs->add($jobsLib);
  239.     //         $jobsLib->addJob($this);
  240.     //     }
  241.     //     return $this;
  242.     // }
  243.     // public function removeJobsLib(JobsLib $jobsLib): self
  244.     // {
  245.     //     if ($this->jobsLibs->removeElement($jobsLib)) {
  246.     //         $jobsLib->removeJob($this);
  247.     //     }
  248.     //     return $this;
  249.     // }
  250.     /**
  251.      * @return Collection<int, AccountJobsList>
  252.      */
  253.     public function getAccountJobsList(): Collection
  254.     {
  255.         return $this->AccountJobsList;
  256.     }
  257.     public function addAccountJobsList(AccountJobsList $accountJobsList): self
  258.     {
  259.         if (!$this->AccountJobsList->contains($accountJobsList)) {
  260.             $this->AccountJobsList->add($accountJobsList);
  261.         }
  262.         return $this;
  263.     }
  264.     public function removeAccountJobsList(AccountJobsList $accountJobsList): self
  265.     {
  266.         $this->AccountJobsList->removeElement($accountJobsList);
  267.         return $this;
  268.     }
  269.     public function getStatus(): ?string
  270.     {
  271.         return $this->status;
  272.     }
  273.     public function setStatus(?string $status): self
  274.     {
  275.         $this->status $status;
  276.         return $this;
  277.     }
  278.     public function getCommandment(): ?MediaObject
  279.     {
  280.         return $this->commandment;
  281.     }
  282.     public function setCommandment(?MediaObject $commandment): self
  283.     {
  284.         $this->commandment $commandment;
  285.         return $this;
  286.     }
  287.     public function getGraph(): ?MediaObject
  288.     {
  289.         return $this->graph;
  290.     }
  291.     public function setGraph(?MediaObject $graph): self
  292.     {
  293.         $this->graph $graph;
  294.         return $this;
  295.     }
  296.     public function getProtocole(): ?MediaObject
  297.     {
  298.         return $this->protocole;
  299.     }
  300.     public function setProtocole(?MediaObject $protocole): self
  301.     {
  302.         $this->protocole $protocole;
  303.         return $this;
  304.     }
  305.     public function getEngineer(): ?Engineer
  306.     {
  307.         return $this->engineer;
  308.     }
  309.     public function setEngineer(?Engineer $engineer): self
  310.     {
  311.         $this->engineer $engineer;
  312.         return $this;
  313.     }
  314.     public function getFactory(): ?Factory
  315.     {
  316.         return $this->factory;
  317.     }
  318.     public function setFactory(?Factory $factory): self
  319.     {
  320.         $this->factory $factory;
  321.         return $this;
  322.     }
  323.     public function getComentar(): ?string
  324.     {
  325.         return $this->comentar;
  326.     }
  327.     public function setComentar(string $comentar): self
  328.     {
  329.         $this->comentar $comentar;
  330.         return $this;
  331.     }
  332. }