UploadedFile.php 14.56 KiB
<?php declare(strict_types=1);
/*
 * irstea/file-upload-bundle - Bundle de gestion de fichiers intégrée à Symfony et Twitter-Bootstrap.
 * Copyright (C) 2015-2019 Irstea <dsi.poleis.contact@lists.irstea.fr>
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option) any
 * later version.
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License and the GNU
 * Lesser General Public License along with this program. If not, see
 * <https://www.gnu.org/licenses/>.
namespace Irstea\FileUploadBundle\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Gaufrette\Exception\FileNotFound;
use Gaufrette\Filesystem;
use Gaufrette\StreamMode;
use InvalidArgumentException;
use Irstea\FileUploadBundle\Model\UploadedFileInterface;
use Irstea\FileUploadBundle\Utils\MimeTypeIcon;
use Ramsey\Uuid\Uuid;
/**
 * @ORM\Entity
 * @ORM\EntityListeners({
 *  "Irstea\FileUploadBundle\Listener\UploadedFileListener",
 *  "Irstea\FileUploadBundle\Listener\CreationDataListener"
 * })
 * @ORM\HasLifecycleCallbacks
class UploadedFile implements UploadedFileInterface
    /**
     * Taille de bloc utilisé pour les copies.
     * @var int
    public static $copyBlockSize = 8192;
    public const ORPHAN_PREFIX = 'orphan/';
    /**
     * @ORM\Id
     * @ORM\Column(type="guid")
     * @var string
    private $id;
    /**
     * @ORM\Column(type="string", length=1024)
     * @var string
    private $displayName;
    /**
     * @ORM\Column(type="string", length=1024)
     * @var string
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
private $path; /** * @var string */ private $actualPath; /** * @ORM\Column(type="string", length=255, nullable=true) * * @var string */ private $mimeType; /** * @ORM\Column(type="integer", nullable=true) * * @var int */ private $size; /** * @ORM\Column(type="string", length=64, nullable=true) * * @var string */ private $checksum; /** * @ORM\Column(type="string", length=10) * * @var string */ private $etat = self::ETAT_EN_COURS; /** * @ORM\Column(type="datetime") * * @var DateTime */ private $createdAt; /** * @ORM\Column(type="string", nullable=true) * * @var string */ private $createdBy; /** * @ORM\Column(type="string", nullable=true) * * @var string */ private $createdFrom; /** * @ORM\Column(type="json_array", nullable=true) * * @var array */ private $metadata; /** * @ORM\Column(type="string", length=256, nullable=true) * * @var string */ private $description;