src/Entity/Attachment.php line 16
<?phpnamespace App\Entity;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use App\Repository\AttachmentRepository;use Symfony\Component\HttpFoundation\File\File;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Serializer\Annotation\Ignore;use Vich\UploaderBundle\Mapping\Annotation as Vich;use Symfony\Component\HttpFoundation\File\UploadedFile;#[Vich\Uploadable]#[ORM\Entity(repositoryClass: AttachmentRepository::class)]class Attachment extends RootEntity{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column(type: 'integer')]#[Groups(['api_index', 'api_view'])]private $id;#[ORM\Column(type: 'string', length: 255, nullable: true)]#[Groups(['api_index', 'api_view'])]private $fileName;#[Vich\UploadableField(mapping: 'upload_file', fileNameProperty: 'filename')]#[Ignore]private $file;#[ORM\Column(type: 'text', nullable: true)]#[Groups(['api_index', 'api_view'])]private $description;#[ORM\Column(type: 'string', length: 255)]private string $foldername = "manual";#[ORM\Column(type: 'array', nullable: true)]private $metadata = [];#[Groups(['api_index', 'api_view'])]public $filePath = null;#[Groups(['api_index', 'api_view'])]public $thumbnail = null;#[ORM\Column(type: 'integer', nullable: true)]private $entityId;#[ORM\Column(type: 'string', length: 255, nullable: true)]private $entityName;#[ORM\Column(nullable: true)]private ?array $allowForRoles = [];#[ORM\Column(nullable: true)]private ?array $allowForUsers = [];#[ORM\ManyToOne]private ?User $user = null;public function __toString(){return "Файл: " . $this->id;}public function getFile(): ?File{return $this->file;}/*** @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile*/public function setFile(?File $imageFile = null): void{$this->file = $imageFile;if ($imageFile) {$oldMetaData = $this->getMetadata();$oldMetaData['temp'] = (new \DateTimeImmutable())->getTimestamp();$this->setMetadata($oldMetaData);}}public function getId(): ?int{return $this->id;}public function getFileName(): ?string{return $this->fileName;}public function setFileName(?string $fileName): self{$this->fileName = $fileName;return $this;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): self{$this->description = $description;return $this;}public function getFoldername(): ?string{return $this->foldername;}public function setFoldername(string $foldername): self{$this->foldername = $foldername;return $this;}public function getMetadata(): ?array{return $this->metadata;}public function setMetadata(?array $metadata): self{$this->metadata = $metadata;return $this;}public function getEntityId(): ?int{return $this->entityId;}public function setEntityId(?int $entityId): self{$this->entityId = $entityId;return $this;}public function getEntityName(): ?string{return $this->entityName;}public function setEntityName(?string $entityName): self{$this->entityName = $entityName;return $this;}public function getAllowForRoles(): array{return $this->allowForRoles;}public function setAllowForRoles(?array $allowForRoles): self{$this->allowForRoles = $allowForRoles;return $this;}public function getAllowForUsers(): array{return $this->allowForUsers;}public function setAllowForUsers(?array $allowForUsers): self{$this->allowForUsers = $allowForUsers;return $this;}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): self{$this->user = $user;return $this;}}