src/Entity/DocxGenerated.php line 10

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DocxGeneratedRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassDocxGeneratedRepository::class)]
  7. class DocxGenerated
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\Column(typeTypes::ARRAY, nullabletrue)]
  14.     private array $fields = [];
  15.     #[ORM\ManyToOne]
  16.     private ?File $file null;
  17.     #[ORM\ManyToOne(inversedBy'generatedDocs')]
  18.     private ?Document $fromDocx null;
  19.     public function getId(): ?int
  20.     {
  21.         return $this->id;
  22.     }
  23.     public function getFields(): array
  24.     {
  25.         return $this->fields;
  26.     }
  27.     public function setFields(?array $fields): self
  28.     {
  29.         $this->fields $fields;
  30.         return $this;
  31.     }
  32.     public function getFile(): ?File
  33.     {
  34.         return $this->file;
  35.     }
  36.     public function setFile(?File $file): self
  37.     {
  38.         $this->file $file;
  39.         return $this;
  40.     }
  41.     public function getFromDocx(): ?Document
  42.     {
  43.         return $this->fromDocx;
  44.     }
  45.     public function setFromDocx(?Document $fromDocx): self
  46.     {
  47.         $this->fromDocx $fromDocx;
  48.         return $this;
  49.     }
  50.     public function fieldsToString($separator ", ")
  51.     {
  52.         $res "";
  53.         foreach($this->fields as $k => $v) {
  54.             $res .= $k ":" $v $separator;
  55.         }
  56.         return trim(trim($res), ",");
  57.     }
  58. }