src/Entity/Section.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\TimestampableTrait;
  4. use App\Repository\SectionRepository;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassSectionRepository::class)]
  8. class Section
  9. {
  10.     use TimestampableTrait;
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[ORM\Column(type'string'length255)]
  16.     private $name;
  17.     #[ORM\Column(type'text')]
  18.     private $text;
  19.     #[ORM\ManyToOne(targetEntityWorkroom::class, inversedBy'sections')]
  20.     #[ORM\JoinColumn(onDelete'CASCADE')]
  21.     private $workroom;
  22.     #[ORM\Column(type'string'length255uniquetrue)]
  23.     private $uuid;
  24.     #[ORM\Column(type'integer'nullabletrue)]
  25.     private $parentId;
  26.     #[ORM\Column(type'smallint')]
  27.     private $level;
  28.     #[ORM\Column(type'smallint')]
  29.     private $position;
  30.     #[ORM\Column(type'boolean'options: ['default' => 0])]
  31.     private $readonly;
  32.     #[ORM\Column(type'boolean'options: ['default' => 0])]
  33.     private $isTracking;
  34.     #[ORM\OneToMany(targetEntitySectionRevision::class, mappedBy'section'cascade: ['persist'])]
  35.     private $sectionRevisions;
  36.     #[ORM\Column(type'integer'nullabletrue)]
  37.     private $countWords;
  38.     #[ORM\Column(type'integer'nullabletrue)]
  39.     private $countCharacters;
  40.     /** Chemin DOCX dans le storage Flysystem (Euro-Office) */
  41.     #[ORM\Column(type'string'length512nullabletrue)]
  42.     private ?string $docxPath null;
  43.     /** Clé OnlyOffice — change à chaque save pour invalider le cache DocServer */
  44.     #[ORM\Column(type'string'length64nullabletrue)]
  45.     private ?string $docxKey null;
  46.     #[ORM\Column(type'datetime_immutable'nullabletrue)]
  47.     private ?\DateTimeImmutable $lastSavedAt null;
  48.     public function getDocxPath(): ?string { return $this->docxPath; }
  49.     public function setDocxPath(?string $v): self $this->docxPath $v; return $this; }
  50.     public function getDocxKey(): ?string { return $this->docxKey; }
  51.     public function setDocxKey(?string $v): self $this->docxKey $v; return $this; }
  52.     public function regenerateDocxKey(): self $this->docxKey bin2hex(random_bytes(8)); return $this; }
  53.     public function getLastSavedAt(): ?\DateTimeImmutable { return $this->lastSavedAt; }
  54.     public function setLastSavedAt(?\DateTimeImmutable $v): self $this->lastSavedAt $v; return $this; }
  55.     /**
  56.      * @return int|null
  57.      */
  58.     public function getId(): ?int
  59.     {
  60.         return $this->id;
  61.     }
  62.     /**
  63.      * @return string|null
  64.      */
  65.     public function getName(): ?string
  66.     {
  67.         return $this->name;
  68.     }
  69.     /**
  70.      * @param string $name
  71.      * @return $this
  72.      */
  73.     public function setName(string $name): self
  74.     {
  75.         $this->name $name;
  76.         return $this;
  77.     }
  78.     /**
  79.      * @return string|null
  80.      */
  81.     public function getText(): ?string
  82.     {
  83.         return $this->text;
  84.     }
  85.     /**
  86.      * @param string $text
  87.      * @return $this
  88.      */
  89.     public function setText(string $text): self
  90.     {
  91.         $this->text $text;
  92.         return $this;
  93.     }
  94.     /**
  95.      * @return Workroom|null
  96.      */
  97.     public function getWorkroom(): ?Workroom
  98.     {
  99.         return $this->workroom;
  100.     }
  101.     /**
  102.      * @param Workroom|null $workroom
  103.      * @return $this
  104.      */
  105.     public function setWorkroom(?Workroom $workroom): self
  106.     {
  107.         $this->workroom $workroom;
  108.         return $this;
  109.     }
  110.     /**
  111.      * @return int|null
  112.      */
  113.     public function getParentId(): ?int
  114.     {
  115.         return $this->parentId;
  116.     }
  117.     /**
  118.      * @param int $parentId
  119.      * @return $this
  120.      */
  121.     public function setParentId(?int $parentId): self
  122.     {
  123.         $this->parentId $parentId;
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return int|null
  128.      */
  129.     public function getLevel(): ?int
  130.     {
  131.         return $this->level;
  132.     }
  133.     /**
  134.      * @param int $level
  135.      * @return $this
  136.      */
  137.     public function setLevel(int $level): self
  138.     {
  139.         $this->level $level;
  140.         return $this;
  141.     }
  142.     /**
  143.      * @return int|null
  144.      */
  145.     public function getPosition(): ?int
  146.     {
  147.         return $this->position;
  148.     }
  149.     /**
  150.      * @param int $position
  151.      * @return $this
  152.      */
  153.     public function setPosition(int $position): self
  154.     {
  155.         $this->position $position;
  156.         return $this;
  157.     }
  158.     /**
  159.      * @return string|null
  160.      */
  161.     public function getUuid(): ?string
  162.     {
  163.         return $this->uuid;
  164.     }
  165.     /**
  166.      * @param string $uuid
  167.      * @return $this
  168.      */
  169.     public function setUuid(string $uuid): self
  170.     {
  171.         $this->uuid $uuid;
  172.         return $this;
  173.     }
  174.     /**
  175.      * @return int|null
  176.      */
  177.     public function getReadonly(): ?int
  178.     {
  179.         return $this->readonly;
  180.     }
  181.     /**
  182.      * @param int $readonly
  183.      * @return $this
  184.      */
  185.     public function setReadonly(int $readonly): self
  186.     {
  187.         $this->readonly $readonly;
  188.         return $this;
  189.     }
  190.     /**
  191.      * @return bool|null
  192.      */
  193.     public function getIsTracking(): ?bool
  194.     {
  195.         return $this->isTracking;
  196.     }
  197.     /**
  198.      * @param bool $isTracking
  199.      * @return $this
  200.      */
  201.     public function setIsTracking(bool $isTracking): self
  202.     {
  203.         $this->isTracking $isTracking;
  204.         return $this;
  205.     }
  206.     /**
  207.      * @return Collection|SectionRevision[]
  208.      */
  209.     public function getSectionRevisions(): Collection
  210.     {
  211.         return $this->sectionRevisions;
  212.     }
  213.     /**
  214.      * @return $this
  215.      */
  216.     public function addSectionRevision(SectionRevision $sectionRevision): self
  217.     {
  218.         if (!$this->sectionRevisions->contains($sectionRevision)) {
  219.             $this->sectionRevisions[] = $sectionRevision;
  220.             $sectionRevision->setSection($this);
  221.         }
  222.         return $this;
  223.     }
  224.     /**
  225.      * @return $this
  226.      */
  227.     public function removeSectionRevision(SectionRevision $sectionRevision): self
  228.     {
  229.         if ($this->sectionRevisions->removeElement($sectionRevision)) {
  230.             // set the owning side to null (unless already changed)
  231.             if ($sectionRevision->getSection() === $this) {
  232.                 $sectionRevision->setSection(null);
  233.             }
  234.         }
  235.         return $this;
  236.     }
  237.     public function getCountWords(): ?int
  238.     {
  239.         return $this->countWords;
  240.     }
  241.     public function setCountWords(?int $countWords): self
  242.     {
  243.         $this->countWords $countWords;
  244.         return $this;
  245.     }
  246.     public function getCountCharacters(): ?int
  247.     {
  248.         return $this->countCharacters;
  249.     }
  250.     public function setCountCharacters(?int $countCharacters): self
  251.     {
  252.         $this->countCharacters $countCharacters;
  253.         return $this;
  254.     }
  255. }