src/Entity/AccountWorker.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\AccountWorkerRepository;
  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(repositoryClassAccountWorkerRepository::class)]
  15. #[ApiResource(
  16.     normalizationContext: ['groups' => ['account_worker:read']],
  17.     denormalizationContext: ['groups' => ['account_worker:write']],
  18.     order: ['id' => 'DESC'],
  19. )]
  20. class AccountWorker
  21. {
  22.     #[Groups(['account_worker:read''account_worker:write''account:read''read''account:write''write''worker:read''worker:write'])]
  23.     #[ORM\Id]
  24.     #[ORM\GeneratedValue]
  25.     #[ORM\Column]
  26.     private ?int $id null
  27.     #[Groups(['account_worker:read''account_worker:write''worker:read''worker:write'])]
  28.     #[ORM\ManyToOne(inversedBy'accountWorkers')]
  29.     #[ORM\JoinColumn(nullablefalse)]
  30.     private ?Accounts $account null;
  31.     #[Groups(['account_worker:read''account_worker:write''account:read''read''account:write''write'])]
  32.     #[ORM\ManyToOne(inversedBy'accountWorkers')]
  33.     private ?Workers $worker null;
  34.     #[Groups(['account_worker:read''account_worker:write''account:read''read''account:write''write''worker:read''worker:write'])]
  35.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  36.     private ?\DateTimeInterface $dateEntered null;
  37.     #[Groups(['account_worker:read''account_worker:write''account:read''read''account:write''write''worker:read''worker:write'])]
  38.     #[ORM\OneToMany(mappedBy'accountWorker'targetEntityMediaObject::class)]
  39.     private Collection $media;
  40.     #[Groups(['account_worker:read''account_worker:write''account:read''read''account:write''write''worker:read''worker:write'])]
  41.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  42.     private ?string $description null;
  43.     #[Groups(['account_worker:read''account_worker:write''account:read''read''account:write''write''worker:read''worker:write'])]
  44.     #[ORM\Column(length100nullabletrue)]
  45.     private ?string $code1c null;
  46.     public function __construct()
  47.     {
  48.         $this->media = new ArrayCollection();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getAccount(): ?Accounts
  55.     {
  56.         return $this->account;
  57.     }
  58.     public function setAccount(?Accounts $account): self
  59.     {
  60.         $this->account $account;
  61.         return $this;
  62.     }
  63.     public function getWorker(): ?Workers
  64.     {
  65.         return $this->worker;
  66.     }
  67.     public function setWorker(?Workers $worker): self
  68.     {
  69.         $this->worker $worker;
  70.         return $this;
  71.     }
  72.     public function getDateEntered(): ?\DateTimeInterface
  73.     {
  74.         return $this->dateEntered;
  75.     }
  76.     public function setDateEntered(?\DateTimeInterface $dateEntered): self
  77.     {
  78.         $this->dateEntered $dateEntered;
  79.         return $this;
  80.     }
  81.     /**
  82.      * @return Collection<int, MediaObject>
  83.      */
  84.     public function getMedia(): Collection
  85.     {
  86.         return $this->media;
  87.     }
  88.     public function addMedium(MediaObject $medium): self
  89.     {
  90.         if (!$this->media->contains($medium)) {
  91.             $this->media->add($medium);
  92.             $medium->setAccountWorker($this);
  93.         }
  94.         return $this;
  95.     }
  96.     public function removeMedium(MediaObject $medium): self
  97.     {
  98.         if ($this->media->removeElement($medium)) {
  99.             // set the owning side to null (unless already changed)
  100.             if ($medium->getAccountWorker() === $this) {
  101.                 $medium->setAccountWorker(null);
  102.             }
  103.         }
  104.         return $this;
  105.     }
  106.     public function getDescription(): ?string
  107.     {
  108.         return $this->description;
  109.     }
  110.     public function setDescription(?string $description): self
  111.     {
  112.         $this->description $description;
  113.         return $this;
  114.     }
  115.     public function getCode1c(): ?string
  116.     {
  117.         return $this->code1c;
  118.     }
  119.     public function setCode1c(?string $code1c): self
  120.     {
  121.         $this->code1c $code1c;
  122.         return $this;
  123.     }
  124. }