src/Entity/Jobs.php line 39

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. use ApiPlatform\Doctrine\Orm\Filter\DateFilter;
  15. #[ORM\Entity(repositoryClassJobsRepository::class)]
  16. #[ApiResource(
  17.     normalizationContext: ['groups' => ['job:read']],
  18.     denormalizationContext: ['groups' => ['job:write']],
  19.     order: ['id' => 'DESC'],
  20. )]
  21. #[ApiFilter(SearchFilter::class, properties: [
  22.     'name' => 'ipartial'
  23.     'code1c' => 'exact'
  24.     'email' => 'exact'
  25.     'status' => 'exact'
  26.     'account.user.id' => 'exact'
  27.     'account.id' => 'exact'
  28.     'account.name' => 'ipartial',
  29.     'factory.id' => 'exact'
  30.     'assignedUser.id' => 'exact'
  31. ])]
  32. #[ApiFilter(DateFilter::class, properties: ['dateEntered'])]
  33. class Jobs
  34. {
  35.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write''job_woker:read'])]
  36.     #[ORM\Id]
  37.     #[ORM\GeneratedValue]
  38.     #[ORM\Column]
  39.     private ?int $id null;
  40.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write''job_woker:read' ])]
  41.     #[ORM\Column(length255nullabletrue)]
  42.     private ?string $name null;
  43.     #[Groups(['job:read''job:write''worker:read''worker:write'])]
  44.     #[ORM\ManyToOne(inversedBy'jobs')]
  45.     private ?Accounts $account null;
  46.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write''job_woker:read' ])]
  47.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  48.     private ?string $description null;
  49.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write','job_woker:read'    ])]
  50.     #[ORM\Column(length100nullabletrue)]
  51.     private ?string $code1c null;
  52.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write''job_woker:read' ])]
  53.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  54.     private ?\DateTimeInterface $dateEntered null;
  55.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write''job_woker:read' ])]
  56.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  57.     private ?\DateTimeInterface $date null;
  58.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  59.     #[ORM\OneToMany(mappedBy'job'targetEntityJobWorker::class)]
  60.     private Collection $jobWorkers;
  61.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  62.     #[ORM\OneToMany(mappedBy'job'targetEntityMediaObject::class)]
  63.     private Collection $mediaObjects;
  64.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' 'job_woker:read'])]
  65.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  66.     private ?\DateTimeInterface $dateStart null;
  67.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write''job_woker:read' ])]
  68.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  69.     private ?\DateTimeInterface $dateEnd null;
  70.     // #[Groups(['job:read', 'job:write', 'worker:read', 'worker:write', 'account_worker:read', 'account:read', 'read', 'account:write' ])]
  71.     // #[ORM\ManyToMany(targetEntity: JobsLib::class, mappedBy: 'jobs')]
  72.     // private Collection $jobsLibs;
  73.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  74.     #[ORM\ManyToMany(targetEntityAccountJobsList::class, inversedBy'jobs')]
  75.     private Collection $AccountJobsList;
  76.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  77.     #[ORM\Column(length100nullabletrue)]
  78.     private ?string $status null;
  79.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  80.     #[ORM\ManyToOne(inversedBy'commandment_jobs'cascade:['persist'])]
  81.     private ?MediaObject $commandment null;
  82.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  83.     #[ORM\ManyToOne(inversedBy'graph_jobs'cascade:['persist'])]
  84.     private ?MediaObject $graph null;
  85.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  86.     #[ORM\ManyToOne(inversedBy'protocole_jobs'cascade:['persist']
  87.     )]
  88.     private ?MediaObject $protocole 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 ?Engineer $engineer null;
  92.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  93.     #[ORM\ManyToOne(inversedBy'jobs')]
  94.     private ?Factory $factory null;
  95.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''read''account:write' ])]
  96.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  97.     private ?string $comentar null;
  98.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''account:write' ])]
  99.     #[ORM\ManyToOne(inversedBy'assigned_jobs')]
  100.     private ?User $assignedUser null;
  101.     #[Groups(['job:write''worker:read''worker:write''account_worker:read''account:read''account:write' ])]
  102.     #[ORM\ManyToMany(targetEntitySpecialMachinery::class, inversedBy'jobs')]
  103.     private Collection $specialMachineries;
  104.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''account:write' ])]
  105.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  106.     private ?\DateTimeInterface $dateStartAudit null;
  107.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''account:write' ])]
  108.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  109.     private ?\DateTimeInterface $dateAudit null;
  110.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''account:write' ])]
  111.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  112.     private ?\DateTimeInterface $dateSendC1 null;
  113.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''account:write' ])]
  114.     #[ORM\Column(length20nullabletrue)]
  115.     private ?string $statusMainEngineerOp null;
  116.     #[Groups(['job:write' ])]
  117.     #[ORM\ManyToOne(inversedBy'mainEngineerOp')]
  118.     private ?User $mainEngineerOp null;
  119.     #[Groups(['job:read''job:write''worker:read''worker:write''account_worker:read''account:read''account:write' ])]
  120.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  121.     private ?\DateTimeInterface $dateMainEngineerOp null;
  122.     public function __construct()
  123.     {
  124.         $this->jobWorkers = new ArrayCollection();
  125.         $this->mediaObjects = new ArrayCollection();
  126.         // $this->jobsLibs = new ArrayCollection();
  127.         $this->AccountJobsList = new ArrayCollection();
  128.         $this->specialMachineries = new ArrayCollection();
  129.     }
  130.     public function getId(): ?int
  131.     {
  132.         return $this->id;
  133.     }
  134.     public function getName(): ?string
  135.     {
  136.         return $this->name;
  137.     }
  138.     public function setName(?string $name): self
  139.     {
  140.         $this->name $name;
  141.         return $this;
  142.     }
  143.     public function getAccount(): ?Accounts
  144.     {
  145.         return $this->account;
  146.     }
  147.     public function setAccount(?Accounts $account): self
  148.     {
  149.         $this->account $account;
  150.         return $this;
  151.     }
  152.     public function getDescription(): ?string
  153.     {
  154.         return $this->description;
  155.     }
  156.     public function setDescription(?string $description): self
  157.     {
  158.         $this->description $description;
  159.         return $this;
  160.     }
  161.     public function getCode1c(): ?string
  162.     {
  163.         return $this->code1c;
  164.     }
  165.     public function setCode1c(?string $code1c): self
  166.     {
  167.         $this->code1c $code1c;
  168.         return $this;
  169.     }
  170.     public function getDateEntered(): ?\DateTimeInterface
  171.     {
  172.         return $this->dateEntered;
  173.     }
  174.     public function setDateEntered(?\DateTimeInterface $dateEntered): self
  175.     {
  176.         $this->dateEntered $dateEntered;
  177.         return $this;
  178.     }
  179.     public function getDate(): ?\DateTimeInterface
  180.     {
  181.         return $this->date;
  182.     }
  183.     public function setDate(?\DateTimeInterface $date): self
  184.     {
  185.         $this->date $date;
  186.         return $this;
  187.     }
  188.     /**
  189.      * @return Collection<int, JobWorker>
  190.      */
  191.     public function getJobWorkers(): Collection
  192.     {
  193.         return $this->jobWorkers;
  194.     }
  195.     public function addJobWorker(JobWorker $jobWorker): self
  196.     {
  197.         if (!$this->jobWorkers->contains($jobWorker)) {
  198.             $this->jobWorkers->add($jobWorker);
  199.             $jobWorker->setJob($this);
  200.         }
  201.         return $this;
  202.     }
  203.     public function removeJobWorker(JobWorker $jobWorker): self
  204.     {
  205.         if ($this->jobWorkers->removeElement($jobWorker)) {
  206.             // set the owning side to null (unless already changed)
  207.             if ($jobWorker->getJob() === $this) {
  208.                 $jobWorker->setJob(null);
  209.             }
  210.         }
  211.         return $this;
  212.     }
  213.     /**
  214.      * @return Collection<int, MediaObject>
  215.      */
  216.     public function getMediaObjects(): Collection
  217.     {
  218.         return $this->mediaObjects;
  219.     }
  220.     public function addMediaObject(MediaObject $mediaObject): self
  221.     {
  222.         if (!$this->mediaObjects->contains($mediaObject)) {
  223.             $this->mediaObjects->add($mediaObject);
  224.             $mediaObject->setJob($this);
  225.         }
  226.         return $this;
  227.     }
  228.     public function removeMediaObject(MediaObject $mediaObject): self
  229.     {
  230.         if ($this->mediaObjects->removeElement($mediaObject)) {
  231.             // set the owning side to null (unless already changed)
  232.             if ($mediaObject->getJob() === $this) {
  233.                 $mediaObject->setJob(null);
  234.             }
  235.         }
  236.         return $this;
  237.     }
  238.     public function getDateStart(): ?\DateTimeInterface
  239.     {
  240.         return $this->dateStart;
  241.     }
  242.     public function setDateStart(?\DateTimeInterface $dateStart): self
  243.     {
  244.         $this->dateStart $dateStart;
  245.         return $this;
  246.     }
  247.     public function getDateEnd(): ?\DateTimeInterface
  248.     {
  249.         return $this->dateEnd;
  250.     }
  251.     public function setDateEnd(?\DateTimeInterface $dateEnd): self
  252.     {
  253.         $this->dateEnd $dateEnd;
  254.         return $this;
  255.     }
  256.     // /**
  257.     //  * @return Collection<int, JobsLib>
  258.     //  */
  259.     // public function getJobsLibs(): Collection
  260.     // {
  261.     //     return $this->jobsLibs;
  262.     // }
  263.     // public function addJobsLib(JobsLib $jobsLib): self
  264.     // {
  265.     //     if (!$this->jobsLibs->contains($jobsLib)) {
  266.     //         $this->jobsLibs->add($jobsLib);
  267.     //         $jobsLib->addJob($this);
  268.     //     }
  269.     //     return $this;
  270.     // }
  271.     // public function removeJobsLib(JobsLib $jobsLib): self
  272.     // {
  273.     //     if ($this->jobsLibs->removeElement($jobsLib)) {
  274.     //         $jobsLib->removeJob($this);
  275.     //     }
  276.     //     return $this;
  277.     // }
  278.     /**
  279.      * @return Collection<int, AccountJobsList>
  280.      */
  281.     public function getAccountJobsList(): Collection
  282.     {
  283.         return $this->AccountJobsList;
  284.     }
  285.     public function addAccountJobsList(AccountJobsList $accountJobsList): self
  286.     {
  287.         if (!$this->AccountJobsList->contains($accountJobsList)) {
  288.             $this->AccountJobsList->add($accountJobsList);
  289.         }
  290.         return $this;
  291.     }
  292.     public function removeAccountJobsList(AccountJobsList $accountJobsList): self
  293.     {
  294.         $this->AccountJobsList->removeElement($accountJobsList);
  295.         return $this;
  296.     }
  297.     public function getStatus(): ?string
  298.     {
  299.         return $this->status;
  300.     }
  301.     public function setStatus(?string $status): self
  302.     {
  303.         $this->status $status;
  304.         return $this;
  305.     }
  306.     public function getCommandment(): ?MediaObject
  307.     {
  308.         return $this->commandment;
  309.     }
  310.     public function setCommandment(?MediaObject $commandment): self
  311.     {
  312.         $this->commandment $commandment;
  313.         return $this;
  314.     }
  315.     public function getGraph(): ?MediaObject
  316.     {
  317.         return $this->graph;
  318.     }
  319.     public function setGraph(?MediaObject $graph): self
  320.     {
  321.         $this->graph $graph;
  322.         return $this;
  323.     }
  324.     public function getProtocole(): ?MediaObject
  325.     {
  326.         return $this->protocole;
  327.     }
  328.     public function setProtocole(?MediaObject $protocole): self
  329.     {
  330.         $this->protocole $protocole;
  331.         return $this;
  332.     }
  333.     public function getEngineer(): ?Engineer
  334.     {
  335.         return $this->engineer;
  336.     }
  337.     public function setEngineer(?Engineer $engineer): self
  338.     {
  339.         $this->engineer $engineer;
  340.         return $this;
  341.     }
  342.     public function getFactory(): ?Factory
  343.     {
  344.         return $this->factory;
  345.     }
  346.     public function setFactory(?Factory $factory): self
  347.     {
  348.         $this->factory $factory;
  349.         return $this;
  350.     }
  351.     public function getComentar(): ?string
  352.     {
  353.         return $this->comentar;
  354.     }
  355.     public function setComentar(string $comentar): self
  356.     {
  357.         $this->comentar $comentar;
  358.         return $this;
  359.     }
  360.     public function getAssignedUser(): ?User
  361.     {
  362.         return $this->assignedUser;
  363.     }
  364.     public function setAssignedUser(?User $assignedUser): self
  365.     {
  366.         $this->assignedUser $assignedUser;
  367.         return $this;
  368.     }
  369.     /**
  370.      * @return Collection<int, SpecialMachineries>
  371.      */
  372.     public function getSpecialMachineries(): Collection
  373.     {
  374.         return $this->specialMachineries;
  375.     }
  376.     public function addSpecialMachinery(SpecialMachinery $specialMachinery): static
  377.     {
  378.         if (!$this->specialMachineries->contains($specialMachinery)) {
  379.             $this->specialMachineries->add($specialMachinery);
  380.         }
  381.         return $this;
  382.     }
  383.     public function removeSpecialMachinery(SpecialMachinery $specialMachinery): static
  384.     {
  385.         $this->specialMachineries->removeElement($specialMachinery);
  386.         return $this;
  387.     }
  388.     public function getdateStartAudit(): ?\DateTimeInterface
  389.     {
  390.         return $this->dateStartAudit;
  391.     }
  392.     public function setdateStartAudit(?\DateTimeInterface $dateStartAudit): static
  393.     {
  394.         $this->dateStartAudit $dateStartAudit;
  395.         return $this;
  396.     }
  397.     public function getDateAudit(): ?\DateTimeInterface
  398.     {
  399.         return $this->dateAudit;
  400.     }
  401.     public function setDateAudit(?\DateTimeInterface $dateAudit): static
  402.     {
  403.         $this->dateAudit $dateAudit;
  404.         return $this;
  405.     }
  406.     public function getDateSendC1(): ?\DateTimeInterface
  407.     {
  408.         return $this->dateSendC1;
  409.     }
  410.     public function setDateSendC1(?\DateTimeInterface $dateSendC1): static
  411.     {
  412.         $this->dateSendC1 $dateSendC1;
  413.         return $this;
  414.     }
  415.     public function getStatusMainEngineerOp(): ?string
  416.     {
  417.         return $this->statusMainEngineerOp;
  418.     }
  419.     public function setStatusMainEngineerOp(?string $statusMainEngineerOp): static
  420.     {
  421.         $this->statusMainEngineerOp $statusMainEngineerOp;
  422.         return $this;
  423.     }
  424.     public function getMainEngineerOp(): ?User
  425.     {
  426.         return $this->mainEngineerOp;
  427.     }
  428.     public function setMainEngineerOp(?User $mainEngineerOp): static
  429.     {
  430.         $this->mainEngineerOp $mainEngineerOp;
  431.         return $this;
  432.     }
  433.     public function getDateMainEngineerOp(): ?\DateTimeInterface
  434.     {
  435.         return $this->dateMainEngineerOp;
  436.     }
  437.     public function setDateMainEngineerOp(?\DateTimeInterface $dateMainEngineerOp): static
  438.     {
  439.         $this->dateMainEngineerOp $dateMainEngineerOp;
  440.         return $this;
  441.     }
  442. }