The {@see Tag tags} */ #[ORM\ManyToMany(targetEntity: Tag::class, inversedBy: 'documents')] private Collection $tags; /** * Initialization */ public function __construct () { $this->tags = new ArrayCollection(); } /** * The owner * * @return User The owner */ public function getOwner (): User { return $this->owner; } /** * Change the owner * * @param User $owner The new owner * * @return $this */ public function setOwner (User $owner): self { $this->owner = $owner; return $this; } /** * The file path, relative to owner directory (aka “file name”) * * @return string|null The file path, relative to owner directory (aka “file name”) */ public function getFilePath (): ?string { return $this->filePath; } /** * Change the file path, relative to owner directory (aka “file name”) * * @param string $filePath The new file path, relative to owner directory (aka “file name”) * * @return $this */ public function setFilePath (string $filePath): static { $this->filePath = $filePath; return $this; } /** * The original file name * * @return string|null The original file name */ public function getFileName (): ?string { return $this->fileName; } /** * Change the original file name * * @param string $fileName The new original file name * * @return $this */ public function setFileName (string $fileName): static { $this->fileName = $fileName; return $this; } /** * The file mime type * * @return string|null The file mime type */ public function getFileType (): ?string { return $this->fileType; } /** * Change the file mime type * * @param string $fileType The new file mime type * * @return $this */ public function setFileType (string $fileType): static { $this->fileType = $fileType; return $this; } /** * The file size, in bytes * * @return int|null The file size, in bytes */ public function getFileSize (): ?int { return $this->fileSize; } /** * Change the file size, in bytes * * @param int $fileSize The new file size, in bytes * * @return $this */ public function setFileSize (int $fileSize): static { $this->fileSize = $fileSize; return $this; } /** * The description * * @return string|null The description */ public function getDescription (): ?string { return $this->description; } /** * Change the description * * @param string|null $description The new description * * @return $this */ public function setDescription (?string $description): self { $this->description = $description; return $this; } /** * The {@see Tag tags} * * @return Collection The {@see Tag tags} */ public function getTags (): Collection { return $this->tags; } /** * Add a tag * * Do nothing if the tag is already present * * @param Tag $tag The tag to add * * @return $this */ public function addTag (Tag $tag): self { if (!$this->tags->contains($tag)) { $this->tags->add($tag); } return $this; } /** * Remove a tag * * @param Tag $tag The tag to remove * * @return $this */ public function removeTag (Tag $tag): self { $this->tags->removeElement($tag); return $this; } /** * The file directory path * * @param string $globalFileDirectoryPath The global file directory path * * @return string The file directory path * * @see \Gedmo\Mapping\Annotation\Uploadable::$pathMethod * @link https://github.com/doctrine-extensions/DoctrineExtensions/blob/main/doc/uploadable.md#uploadable-annotations-and-attributes * * @noinspection PhpUnused */ public function getFileDirectoryPath (string $globalFileDirectoryPath): string { return $globalFileDirectoryPath . DIRECTORY_SEPARATOR . $this->owner->getId(); } /** * @param array $fileInfo * * @return void * * @see \Gedmo\Mapping\Annotation\Uploadable::$callback * @link https://github.com/doctrine-extensions/DoctrineExtensions/blob/main/doc/uploadable.md#uploadable-annotations-and-attributes * * @noinspection PhpUnused * */ public function onFileMove (array $fileInfo): void { $this->fileName = $fileInfo['origFileName']; // Information absente de la doc mais bien alimentée } }