<?php
namespace App\Entity\MediaObject;
use ApiPlatform\Core\Annotation\ApiProperty;
use App\Entity\Operation\Odr;
use App\Repository\MediaObject\MediaCodeOdrRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\SerializedName;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass=MediaCodeOdrRepository::class)
* @Vich\Uploadable
*/
class MediaCodeOdr extends MediaObject
{
public const MIME_TEXT_PLAIN = 'text/plain';
public const MIME_CSV = 'text/csv';
public const MIME_XLSX = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
public const ARRAY_MIME = [
self::MIME_TEXT_PLAIN,
self::MIME_CSV,
self::MIME_XLSX,
];
public const EXTENSION_CSV = 'csv';
public const EXTENSION_XLSX = 'xlsx';
public const COLUMN_CODE = 'code';
public const ARRAY_COLUMN = [
self::COLUMN_CODE,
];
/**
* @ORM\ManyToOne(targetEntity=Odr::class, inversedBy="mediaCodeOdrs", cascade={"persist"})
* @ORM\JoinColumn(nullable=true, name="object_id")
* @SerializedName("odr")
*/
private $odr;
/**
* @var string|null
* @ApiProperty(iri="http://schema.org/contentUrl")
* @SerializedName("content_url")
* @Groups({
* "MediaObject:output",
* "MediaCodeOdr:output",
* "media_object_read",
* "Gift:output",
* })
*/
private $contentUrl;
/**
* @var File|null
* @Assert\NotNull(
* groups={
* "media_object_read",
* "MediaCodeOdr:io",
* "MediaObject:output",
* })
* @Vich\UploadableField(mapping="odr_code", fileNameProperty="filePath")
* @Groups({
* "Gift:output",
* })
*/
public $file;
/**
* @var string|null
*
* @ORM\Column(nullable=true)
* @SerializedName("file_path")
* @Groups({
* "Gift:output",
* })
*/
public $filePath;
/**
* @return Odr
*/
public function getOdr(): Odr
{
return $this->odr;
}
public function setOdr($odr): self
{
$this->odr = $odr;
return $this;
}
/**
* @return string|null
*/
public function getContentUrl(): ?string
{
return $this->contentUrl;
}
/**
* @param string|null $contentUrl
* @return MediaCodeOdr
*/
public function setContentUrl(?string $contentUrl): MediaCodeOdr
{
$this->contentUrl = $contentUrl;
return $this;
}
/**
* @return string|null
*/
public function __toString()
{
return "".$this->contentUrl;
}
}