src/Entity/ItemDocument.php line 45
<?phpdeclare(strict_types=1);namespace App\Entity;use ApiPlatform\Core\Annotation\ApiResource;use ApiPlatform\Core\Annotation\ApiSubresource;use App\Controller\Api\Action\ItemDocument\ItemDocumentGetAction;use App\Controller\Api\Action\ItemDocument\ItemDocumentPostAction;use App\Entity\Mapped\Entity;use App\Repository\ItemDocumentRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: ItemDocumentRepository::class)]#[ORM\Table(name: 'item_document')]#[ApiResource(collectionOperations: ['post' => ['controller' => ItemDocumentPostAction::class],'get_list' => ['controller' => ItemDocumentGetAction::class,'method' => 'GET','path' => '/item/{id}/documents'],],itemOperations: ['get','delete'],denormalizationContext: ['groups' => ['create']])]class ItemDocument extends Entity implements DocumentInterface{#[ORM\Column(name: 'name',type: 'string',length: 191,nullable: true)]#[Assert\NotBlank(groups: ['create'])]#[Groups(['create'])]private ?string $name = null;#[ORM\Column(name: 'original_name',type: 'string',length: 191,nullable: true)]private ?string $originalName = null;#[ORM\Column(name: 'full_document_path',type: 'string',nullable: true)]private ?string $fullDocumentPath = null;#[ORM\Column(name: 'sequence',type: 'integer',nullable: true)]private ?int $sequence = null;#[ORM\ManyToOne(targetEntity: Item::class,cascade: ['persist'],inversedBy: 'document')]#[ORM\JoinColumn(name: 'item',onDelete: 'CASCADE')]#[Assert\NotBlank(groups: ['create'])]#[Groups(['create'])]#[ApiSubresource]private ?Item $item = null;#[Assert\NotBlank(groups: ['create'])]#[Groups(['create'])]private ?string $file = null;#[ORM\OneToMany(mappedBy: 'itemDocument',targetEntity: ItemDocumentReport::class,cascade: ['persist', 'remove'],fetch: 'EXTRA_LAZY',orphanRemoval: true)]#[Groups(['create'])]private ?iterable $reports;#[ORM\OneToMany(mappedBy: 'itemDocument',targetEntity: ItemDocumentIndicator::class,cascade: ['persist'],fetch: 'EXTRA_LAZY',orphanRemoval: true)]private iterable $documentIndicators;public function __construct(){$this->reports = new ArrayCollection();$this->documentIndicators = new ArrayCollection();}public function getOriginalName(): ?string{return $this->originalName;}public function setOriginalName(?string $originalName): self{$this->originalName = $originalName;return $this;}public function getFullDocumentPath(): ?string{return $this->fullDocumentPath;}public function setFullDocumentPath(?string $fullDocumentPath): self{$this->fullDocumentPath = $fullDocumentPath;return $this;}public function getSequence(): ?int{return $this->sequence;}public function setSequence(?int $sequence): self{$this->sequence = $sequence;return $this;}public function getItem(): ?Item{return $this->item;}public function setItem(?Item $item): self{$this->item = $item;return $this;}public function getName(): ?string{return $this->name;}public function setName(?string $name): self{$this->name = $name;return $this;}public function getFile(): ?string{return $this->file;}public function setFile(?string $file): self{$this->file = $file;return $this;}public function getReports(): ?iterable{return $this->reports;}public function addReport(ItemDocumentReport $itemDocumentReport): void{if ($this->reports->contains($itemDocumentReport)) {return;}$this->reports[] = $itemDocumentReport;$itemDocumentReport->setItemDocument($this);}public function removeReport(ItemDocumentReport $itemDocumentReport): void{if (!$this->reports->contains($itemDocumentReport)) {return;}$this->reports->removeElement($itemDocumentReport);$itemDocumentReport->setItemDocument(null);}public function getDocumentIndicators(): iterable{return $this->documentIndicators;}public function addDocumentIndicator(ItemDocumentIndicator $itemDocumentIndicator): void{if ($this->documentIndicators->contains($itemDocumentIndicator)) {return;}$this->documentIndicators[] = $itemDocumentIndicator;$itemDocumentIndicator->setItemDocument($this);}public function removeDocumentIndicator(ItemDocumentIndicator $itemDocumentIndicator): void{if (!$this->documentIndicators->contains($itemDocumentIndicator)) {return;}$this->documentIndicators->removeElement($itemDocumentIndicator);$itemDocumentIndicator->setItemDocument(null);}}