src/Entity/Utils/Cloudinary/MediaModel.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Utils\Cloudinary;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7.  * Class MediaModel.
  8.  */
  9. #[ORM\Table(name'cloudinary_media_model')]
  10. #[ORM\Entity(repositoryClass'App\Repository\Utils\Cloudinary\MediaModelRepository')]
  11. class MediaModel
  12. {
  13.     /**
  14.      * Id.
  15.      */
  16.     #[ORM\Id]
  17.     #[ORM\Column(type\Doctrine\DBAL\Types\Types::INTEGER)]
  18.     #[ORM\GeneratedValue]
  19.     protected ?int $id null;
  20.     /**
  21.      * Public ID.
  22.      */
  23.     #[ORM\Column(type\Doctrine\DBAL\Types\Types::STRINGlength255nullabletrue)]
  24.     protected ?string $publicId null;
  25.     /**
  26.      * Title.
  27.      */
  28.     #[ORM\Column(type\Doctrine\DBAL\Types\Types::STRINGlength255nullabletrue)]
  29.     #[Assert\Length(min2max255minMessage'back.errors.short'maxMessage'back.errors.long')]
  30.     protected ?string $type null;
  31.     /**
  32.      * Title.
  33.      */
  34.     #[ORM\Column(type\Doctrine\DBAL\Types\Types::STRINGlength255nullabletrue)]
  35.     #[Assert\Length(min2max255minMessage'back.errors.short'maxMessage'back.errors.long')]
  36.     protected ?string $title null;
  37.     /**
  38.      * Alt.
  39.      */
  40.     #[ORM\Column(type\Doctrine\DBAL\Types\Types::STRINGlength255nullabletrue)]
  41.     #[Assert\Length(min2max255minMessage'back.errors.short'maxMessage'back.errors.long')]
  42.     protected ?string $alt null;
  43.     /**
  44.      * Description.
  45.      */
  46.     #[ORM\Column(type\Doctrine\DBAL\Types\Types::TEXTnullabletrue)]
  47.     protected ?string $description null;
  48.     /**
  49.      * Copyright.
  50.      */
  51.     #[ORM\Column(type\Doctrine\DBAL\Types\Types::STRINGlength255nullabletrue)]
  52.     #[Assert\Length(min2max255minMessage'back.errors.short'maxMessage'back.errors.long')]
  53.     protected ?string $copyright null;
  54.     /**
  55.      * Credits.
  56.      */
  57.     #[ORM\Column(type\Doctrine\DBAL\Types\Types::STRINGlength255nullabletrue)]
  58.     #[Assert\Length(min2max255minMessage'back.errors.short'maxMessage'back.errors.long')]
  59.     protected ?string $credits null;
  60.     /**
  61.      * Tags.
  62.      */
  63.     #[ORM\Column(type\Doctrine\DBAL\Types\Types::STRINGlength255nullabletrue)]
  64.     #[Assert\Length(min2max255minMessage'back.errors.short'maxMessage'back.errors.long')]
  65.     protected ?string $tags null;
  66.     /**
  67.      * Original format.
  68.      */
  69.     #[ORM\Column(type\Doctrine\DBAL\Types\Types::STRINGlength255nullabletrue)]
  70.     #[Assert\Length(min2max255minMessage'back.errors.short'maxMessage'back.errors.long')]
  71.     protected ?string $originalFormat null;
  72.     /**
  73.      * Option.
  74.      */
  75.     #[ORM\Column(type\Doctrine\DBAL\Types\Types::STRINGnullabletrue)]
  76.     protected ?string $config null;
  77.     /**
  78.      * Entities.
  79.      *
  80.      * @var \Doctrine\Common\Collections\Collection<\App\Entity\Utils\Cloudinary\Media>
  81.      */
  82.     #[Assert\Valid]
  83.     #[ORM\ManyToMany(targetEntity\App\Entity\Utils\Cloudinary\Media::class, mappedBy'medias'cascade: ['all'])]
  84.     protected \Doctrine\Common\Collections\Collection $entities;
  85.     /**
  86.      * Single Entities.
  87.      *
  88.      * @var \Doctrine\Common\Collections\Collection<\App\Entity\Utils\Cloudinary\Media>
  89.      */
  90.     #[Assert\Valid]
  91.     #[ORM\OneToMany(targetEntity\App\Entity\Utils\Cloudinary\Media::class, mappedBy'singleMedia'cascade: ['all'])]
  92.     protected \Doctrine\Common\Collections\Collection $singleEntities;
  93.     /**
  94.      * MediaModel constructor.
  95.      */
  96.     public function __construct()
  97.     {
  98.         $this->entities       = new ArrayCollection();
  99.         $this->singleEntities = new ArrayCollection();
  100.     }
  101.     public function setId(int $id): void
  102.     {
  103.         $this->id $id;
  104.     }
  105.     public function getId(): ?int
  106.     {
  107.         return $this->id;
  108.     }
  109.     public function getPublicId(): ?string
  110.     {
  111.         return $this->publicId;
  112.     }
  113.     public function setPublicId(?string $publicId): void
  114.     {
  115.         $this->publicId $publicId;
  116.     }
  117.     public function getType(): ?string
  118.     {
  119.         return $this->type;
  120.     }
  121.     public function setType(?string $type): void
  122.     {
  123.         $this->type $type;
  124.     }
  125.     public function getTitle(): ?string
  126.     {
  127.         return $this->title;
  128.     }
  129.     public function setTitle(?string $title): void
  130.     {
  131.         $this->title $title;
  132.     }
  133.     public function getDescription(): ?string
  134.     {
  135.         return $this->description;
  136.     }
  137.     public function setDescription(?string $description): void
  138.     {
  139.         $this->description $description;
  140.     }
  141.     public function getCopyright(): ?string
  142.     {
  143.         return $this->copyright;
  144.     }
  145.     public function setCopyright(?string $copyright): void
  146.     {
  147.         $this->copyright $copyright;
  148.     }
  149.     public function getCredits(): ?string
  150.     {
  151.         return $this->credits;
  152.     }
  153.     public function setCredits(?string $credits): void
  154.     {
  155.         $this->credits $credits;
  156.     }
  157.     public function getTags(): ?string
  158.     {
  159.         return $this->tags;
  160.     }
  161.     public function setTags(?string $tags): void
  162.     {
  163.         $this->tags $tags;
  164.     }
  165.     public function getOriginalFormat(): ?string
  166.     {
  167.         return $this->originalFormat;
  168.     }
  169.     public function setOriginalFormat(?string $originalFormat): void
  170.     {
  171.         $this->originalFormat $originalFormat;
  172.     }
  173.     public function addEntity(Media $entity): void
  174.     {
  175.         $this->entities[] = $entity;
  176.     }
  177.     public function removeEntity(Media $entity): void
  178.     {
  179.         $this->entities->removeElement($entity);
  180.     }
  181.     public function getEntities(): ArrayCollection
  182.     {
  183.         return $this->entities;
  184.     }
  185.     public function addSingleEntity(Media $singleEntity): void
  186.     {
  187.         $this->singleEntities[] = $singleEntity;
  188.     }
  189.     public function removeSingleEntity(Media $singleEntity): void
  190.     {
  191.         $this->singleEntities->removeElement($singleEntity);
  192.     }
  193.     public function getSingleEntities(): ArrayCollection
  194.     {
  195.         return $this->singleEntities;
  196.     }
  197.     public function getConfig(): ?string
  198.     {
  199.         return $this->config;
  200.     }
  201.     public function setConfig(?string $config): void
  202.     {
  203.         $this->config $config;
  204.     }
  205.     public function getAlt(): ?string
  206.     {
  207.         return $this->alt;
  208.     }
  209.     public function setAlt(?string $alt): void
  210.     {
  211.         $this->alt $alt;
  212.     }
  213.     public function getArrayData(): array
  214.     {
  215.         return [
  216.             'id'             => $this->id,
  217.             'publicId'       => $this->publicId,
  218.             'type'           => $this->type,
  219.             'title'          => $this->title,
  220.             'alt'            => $this->alt,
  221.             'description'    => $this->description,
  222.             'originalFormat' => $this->originalFormat,
  223.             'copyright'      => $this->copyright,
  224.             'credits'        => $this->credits,
  225.             'tags'           => $this->tags,
  226.             'config'         => $this->config,
  227.         ];
  228.     }
  229.     public function setArrayData(array $data): void
  230.     {
  231.         $this->setPublicId($data['publicId']);
  232.         $this->setType($data['type']);
  233.         $this->setTitle($data['title']);
  234.         $this->setAlt($data['alt']);
  235.         $this->setDescription($data['description']);
  236.         $this->setOriginalFormat($data['originalFormat']);
  237.         $this->setCopyright($data['copyright']);
  238.         $this->setCredits($data['credits']);
  239.         $this->setTags($data['tags']);
  240.         $this->setConfig($data['config']);
  241.     }
  242. }