<?php
namespace App\Entity\Utils\Cloudinary;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Class MediaModel.
*/
#[ORM\Table(name: 'cloudinary_media_model')]
#[ORM\Entity(repositoryClass: 'App\Repository\Utils\Cloudinary\MediaModelRepository')]
class MediaModel
{
/**
* Id.
*/
#[ORM\Id]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\GeneratedValue]
protected ?int $id = null;
/**
* Public ID.
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
protected ?string $publicId = null;
/**
* Title.
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
#[Assert\Length(min: 2, max: 255, minMessage: 'back.errors.short', maxMessage: 'back.errors.long')]
protected ?string $type = null;
/**
* Title.
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
#[Assert\Length(min: 2, max: 255, minMessage: 'back.errors.short', maxMessage: 'back.errors.long')]
protected ?string $title = null;
/**
* Alt.
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
#[Assert\Length(min: 2, max: 255, minMessage: 'back.errors.short', maxMessage: 'back.errors.long')]
protected ?string $alt = null;
/**
* Description.
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
protected ?string $description = null;
/**
* Copyright.
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
#[Assert\Length(min: 2, max: 255, minMessage: 'back.errors.short', maxMessage: 'back.errors.long')]
protected ?string $copyright = null;
/**
* Credits.
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
#[Assert\Length(min: 2, max: 255, minMessage: 'back.errors.short', maxMessage: 'back.errors.long')]
protected ?string $credits = null;
/**
* Tags.
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
#[Assert\Length(min: 2, max: 255, minMessage: 'back.errors.short', maxMessage: 'back.errors.long')]
protected ?string $tags = null;
/**
* Original format.
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
#[Assert\Length(min: 2, max: 255, minMessage: 'back.errors.short', maxMessage: 'back.errors.long')]
protected ?string $originalFormat = null;
/**
* Option.
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
protected ?string $config = null;
/**
* Entities.
*
* @var \Doctrine\Common\Collections\Collection<\App\Entity\Utils\Cloudinary\Media>
*/
#[Assert\Valid]
#[ORM\ManyToMany(targetEntity: \App\Entity\Utils\Cloudinary\Media::class, mappedBy: 'medias', cascade: ['all'])]
protected \Doctrine\Common\Collections\Collection $entities;
/**
* Single Entities.
*
* @var \Doctrine\Common\Collections\Collection<\App\Entity\Utils\Cloudinary\Media>
*/
#[Assert\Valid]
#[ORM\OneToMany(targetEntity: \App\Entity\Utils\Cloudinary\Media::class, mappedBy: 'singleMedia', cascade: ['all'])]
protected \Doctrine\Common\Collections\Collection $singleEntities;
/**
* MediaModel constructor.
*/
public function __construct()
{
$this->entities = new ArrayCollection();
$this->singleEntities = new ArrayCollection();
}
public function setId(int $id): void
{
$this->id = $id;
}
public function getId(): ?int
{
return $this->id;
}
public function getPublicId(): ?string
{
return $this->publicId;
}
public function setPublicId(?string $publicId): void
{
$this->publicId = $publicId;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): void
{
$this->type = $type;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): void
{
$this->title = $title;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): void
{
$this->description = $description;
}
public function getCopyright(): ?string
{
return $this->copyright;
}
public function setCopyright(?string $copyright): void
{
$this->copyright = $copyright;
}
public function getCredits(): ?string
{
return $this->credits;
}
public function setCredits(?string $credits): void
{
$this->credits = $credits;
}
public function getTags(): ?string
{
return $this->tags;
}
public function setTags(?string $tags): void
{
$this->tags = $tags;
}
public function getOriginalFormat(): ?string
{
return $this->originalFormat;
}
public function setOriginalFormat(?string $originalFormat): void
{
$this->originalFormat = $originalFormat;
}
public function addEntity(Media $entity): void
{
$this->entities[] = $entity;
}
public function removeEntity(Media $entity): void
{
$this->entities->removeElement($entity);
}
public function getEntities(): ArrayCollection
{
return $this->entities;
}
public function addSingleEntity(Media $singleEntity): void
{
$this->singleEntities[] = $singleEntity;
}
public function removeSingleEntity(Media $singleEntity): void
{
$this->singleEntities->removeElement($singleEntity);
}
public function getSingleEntities(): ArrayCollection
{
return $this->singleEntities;
}
public function getConfig(): ?string
{
return $this->config;
}
public function setConfig(?string $config): void
{
$this->config = $config;
}
public function getAlt(): ?string
{
return $this->alt;
}
public function setAlt(?string $alt): void
{
$this->alt = $alt;
}
public function getArrayData(): array
{
return [
'id' => $this->id,
'publicId' => $this->publicId,
'type' => $this->type,
'title' => $this->title,
'alt' => $this->alt,
'description' => $this->description,
'originalFormat' => $this->originalFormat,
'copyright' => $this->copyright,
'credits' => $this->credits,
'tags' => $this->tags,
'config' => $this->config,
];
}
public function setArrayData(array $data): void
{
$this->setPublicId($data['publicId']);
$this->setType($data['type']);
$this->setTitle($data['title']);
$this->setAlt($data['alt']);
$this->setDescription($data['description']);
$this->setOriginalFormat($data['originalFormat']);
$this->setCopyright($data['copyright']);
$this->setCredits($data['credits']);
$this->setTags($data['tags']);
$this->setConfig($data['config']);
}
}