<?php
namespace App\Entity\Image;
use App\Entity\Webfactory\Widget\Classique\Gallery;
use App\Repository\Image\ImageRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Image
*/
#[ORM\Table(name: 'image')]
#[ORM\Entity(repositoryClass: ImageRepository::class)]
class Image implements \Stringable
{
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;
#[ORM\Column(name: 'adherent', type: 'string', length: 255)]
private ?string $adherent = null;
#[ORM\Column(name: 'name', type: 'string', length: 255)]
private ?string $name = null;
#[ORM\Column(name: 'extension', type: 'string', length: 255)]
private ?string $extension = null;
#[ORM\Column(name: 'weight', type: 'string', length: 255, nullable: true)]
private ?string $weight = null;
#[ORM\Column(name: 'width', type: 'string', length: 255, nullable: true)]
private ?string $width = null;
#[ORM\Column(name: 'height', type: 'string', length: 255, nullable: true)]
private ?string $height = null;
#[ORM\Column(name: 'alt', type: 'string', length: 255, nullable: true)]
private ?string $alt = null;
#[ORM\Column(name: 'quality', type: 'string', length: 255, nullable: true)]
private ?string $quality = null;
#[ORM\Column(name: 'profile_default', type: 'boolean', nullable: true)]
private ?bool $profileDefault = null;
#[ORM\Column(name: 'logo_default', type: 'boolean', nullable: true)]
private ?bool $logoDefault = null;
#[ORM\Column(name: 'active', type: 'boolean')]
private ?bool $active = null;
#[ORM\Column(name: 'original', type: 'string', length: 255, nullable: true)]
private ?string $original = null;
#[ORM\Column(name: 'commentaire', type: 'text', nullable: true)]
private ?string $commentaire = null;
#[ORM\ManyToOne(targetEntity: ImgType::class, inversedBy: 'images')]
private $type;
#[ORM\Column(name: 'deleted', type: 'boolean', nullable: true)]
private ?bool $deleted = null;
#[ORM\Column(name: 'created_at', type: 'datetime')]
private \datetime $createdAt;
/**
* @var datetime
*/
#[ORM\Column(name: 'cropped_at', type: 'datetime', nullable: true)]
private $croppedAt;
/**
* @var datetime
*/
#[ORM\Column(name: 'deleted_at', type: 'datetime', nullable: true)]
private $deleteAt;
#[ORM\Column(name: 'print_quality', type: 'integer', nullable: true)]
private ?int $printQuality = null;
#[ORM\ManyToMany(targetEntity: Gallery::class, mappedBy: 'images')]
private $galleries;
private int $rotation;
#[ORM\Column(type: 'boolean', nullable: true)]
private $communicationPrint;
#[ORM\ManyToMany(targetEntity: ImgPublication::class, inversedBy: 'images')]
private $imgPublications;
#[ORM\Column(name: 'generique_id', type: 'string', nullable: true)]
private ?string $generiqueId = null;
public function __construct()
{
$this->imgPublications = new ArrayCollection();
$this->createdAt = new \DateTime("now");
$this->galleries = new ArrayCollection();
}
public function toArray()
{
return [
'id' => $this->id,
'name' => $this->name,
'logo' => $this->logoDefault,
'profile' => $this->profileDefault,
'adherent' => $this->adherent,
'active' => $this->active,
'generique_id' => $this->generiqueId,
'type' => ($this->type) ? $this->type->getName() : 'A définir'
];
}
public function getImgPublications()
{
return $this->imgPublications;
}
public function addImgPublication(ImgPublication $imgPublication): self
{
if (!$this->imgPublications->contains($imgPublication)) {
$this->imgPublications[] = $imgPublication;
}
return $this;
}
public function removeImgPublication(ImgPublication $imgPublication): self
{
if ($this->imgPublications->contains($imgPublication)) {
$this->imgPublications->removeElement($imgPublication);
}
return $this;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set adherent.
*
* @param string $adherent
*
* @return Image
*/
public function setAdherent($adherent)
{
$this->adherent = $adherent;
return $this;
}
/**
* Get adherent.
*
* @return string
*/
public function getAdherent()
{
return $this->adherent;
}
/**
* Set name.
*
* @param string $name
*
* @return Image
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set extension.
*
* @param string $extension
*
* @return Image
*/
public function setExtension($extension)
{
$this->extension = $extension;
return $this;
}
/**
* Get extension.
*
* @return string
*/
public function getExtension()
{
return $this->extension;
}
/**
* Set weight.
*
* @param string|null $weight
*
* @return Image
*/
public function setWeight($weight = null)
{
$this->weight = $weight;
return $this;
}
/**
* Get weight.
*
* @return string|null
*/
public function getWeight()
{
return $this->weight;
}
/**
* Set width.
*
* @param string|null $width
*
* @return Image
*/
public function setWidth($width = null)
{
$this->width = $width;
return $this;
}
/**
* Get width.
*
* @return string|null
*/
public function getWidth()
{
return $this->width;
}
/**
* Set height.
*
* @param string|null $height
*
* @return Image
*/
public function setHeight($height = null)
{
$this->height = $height;
return $this;
}
/**
* Get height.
*
* @return string|null
*/
public function getHeight()
{
return $this->height;
}
/**
* Set alt.
*
* @param string|null $alt
*
* @return Image
*/
public function setAlt($alt = null)
{
$this->alt = $alt;
return $this;
}
/**
* Get alt.
*
* @return string|null
*/
public function getAlt()
{
return $this->alt;
}
/**
* Set quality.
*
* @param string|null $quality
*
* @return Image
*/
public function setQuality($quality = null)
{
$this->quality = $quality;
return $this;
}
/**
* Get quality.
*
* @return string|null
*/
public function getQuality()
{
return $this->quality;
}
/**
* Set profileDefault.
*
* @param bool|null $profileDefault
*
* @return Image
*/
public function setProfileDefault($profileDefault = null)
{
$this->profileDefault = $profileDefault;
return $this;
}
/**
* Get profileDefault.
*
* @return bool|null
*/
public function getProfileDefault()
{
return $this->profileDefault;
}
/**
* Set active.
*
* @param bool $active
*
* @return Image
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
/**
* Get active.
*
* @return bool
*/
public function getActive()
{
return $this->active;
}
/**
* Set original.
*
* @param string|null $original
*
* @return Image
*/
public function setOriginal($original = null)
{
$this->original = $original;
return $this;
}
/**
* Get original.
*
* @return string|null
*/
public function getOriginal()
{
return $this->original;
}
/**
* Set commentaire.
*
* @param string $commentaire
*
* @return Image
*/
public function setCommentaire($commentaire)
{
$this->commentaire = $commentaire;
return $this;
}
/**
* Get commentaire.
*
* @return string
*/
public function getCommentaire()
{
return $this->commentaire;
}
/**
* Set type.
*
* @param int|null $type
*
* @return Image
*/
public function setType($type = null)
{
$this->type = $type;
return $this;
}
/**
* Get type.
*
* @return int|null
*/
public function getType()
{
return $this->type;
}
/**
* @return datetime
*/
public function getCreatedAt(): \DateTime
{
return $this->createdAt;
}
/**
* @param datetime $createdAt
*/
public function setCreatedAt(\DateTime $createdAt): void
{
$this->createdAt = $createdAt;
}
public function isDeleted(): bool
{
return $this->deleted;
}
public function setDeleted(bool $deleted): void
{
$this->deleted = $deleted;
}
/**
* @return datetime
*/
public function getDeleteAt(): \DateTime
{
return $this->deleteAt;
}
/**
* @param datetime $deleteAt
*/
public function setDeleteAt(\DateTime $deleteAt): void
{
$this->deleteAt = $deleteAt;
}
/**
* @return \DateTime
*/
public function getCroppedAt(): ?\DateTime
{
return $this->croppedAt;
}
public function setCroppedAt(\DateTime $croppedAt): void
{
$this->croppedAt = $croppedAt;
}
public function getPrintQuality(): int
{
return $this->printQuality;
}
public function setPrintQuality(int $printQuality): void
{
$this->printQuality = $printQuality;
}
public function __toString(): string
{
return $this->name;
}
/**
* @return bool|null
*/
public function getLogoDefault()
{
return $this->logoDefault;
}
/**
* @param bool|null $logoDefault
*/
public function setLogoDefault($logoDefault)
{
$this->logoDefault = $logoDefault;
}
public function getDimensions()
{
return $this->getWidth() . ' x ' . $this->getHeight();
}
/**
* @return Collection|Gallery[]
*/
public function getGalleries(): Collection
{
return $this->galleries;
}
public function addGallery(Gallery $gallery): self
{
if (!$this->galleries->contains($gallery)) {
$this->galleries[] = $gallery;
$gallery->addImage($this);
}
return $this;
}
public function removeGallery(Gallery $gallery): self
{
if ($this->galleries->removeElement($gallery)) {
$gallery->removeImage($this);
}
return $this;
}
/**
* @return int
*/
public function getRotation(): int
{
return $this->rotation;
}
/**
* @param int $rotation
*/
public function setRotation(int $rotation): void
{
$this->rotation = $rotation;
}
/**
* @return mixed
*/
public function getCommunicationPrint()
{
return $this->communicationPrint;
}
/**
* @param mixed $communicationPrint
*/
public function setCommunicationPrint($communicationPrint): void
{
$this->communicationPrint = $communicationPrint;
}
/**
* @return string|null
*/
public function getGeneriqueId(): ?string
{
return $this->generiqueId;
}
/**
* @param string|null generique_id
*/
public function setGeneriqueId(?string $generiqueId): void
{
$this->generiqueId = $generiqueId;
}
}