src/Entity/Image/Image.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Image;
  3. use App\Entity\Webfactory\Widget\Classique\Gallery;
  4. use App\Repository\Image\ImageRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * Image
  10.  */
  11. #[ORM\Table(name'image')]
  12. #[ORM\Entity(repositoryClassImageRepository::class)]
  13. class Image implements \Stringable
  14. {
  15.     #[ORM\Column(name'id'type'integer')]
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue(strategy'AUTO')]
  18.     private ?int $id null;
  19.     #[ORM\Column(name'adherent'type'string'length255)]
  20.     private ?string $adherent null;
  21.     #[ORM\Column(name'name'type'string'length255)]
  22.     private ?string $name null;
  23.     #[ORM\Column(name'extension'type'string'length255)]
  24.     private ?string $extension null;
  25.     #[ORM\Column(name'weight'type'string'length255nullabletrue)]
  26.     private ?string $weight null;
  27.     #[ORM\Column(name'width'type'string'length255nullabletrue)]
  28.     private ?string $width null;
  29.     #[ORM\Column(name'height'type'string'length255nullabletrue)]
  30.     private ?string $height null;
  31.     #[ORM\Column(name'alt'type'string'length255nullabletrue)]
  32.     private ?string $alt null;
  33.     #[ORM\Column(name'quality'type'string'length255nullabletrue)]
  34.     private ?string $quality null;
  35.     #[ORM\Column(name'profile_default'type'boolean'nullabletrue)]
  36.     private ?bool $profileDefault null;
  37.     #[ORM\Column(name'logo_default'type'boolean'nullabletrue)]
  38.     private ?bool $logoDefault null;
  39.     #[ORM\Column(name'active'type'boolean')]
  40.     private ?bool $active null;
  41.     #[ORM\Column(name'original'type'string'length255nullabletrue)]
  42.     private ?string $original null;
  43.     #[ORM\Column(name'commentaire'type'text'nullabletrue)]
  44.     private ?string $commentaire null;
  45.     #[ORM\ManyToOne(targetEntityImgType::class, inversedBy'images')]
  46.     private $type;
  47.     #[ORM\Column(name'deleted'type'boolean'nullabletrue)]
  48.     private ?bool $deleted null;
  49.     #[ORM\Column(name'created_at'type'datetime')]
  50.     private \datetime $createdAt;
  51.     /**
  52.      * @var datetime
  53.      */
  54.     #[ORM\Column(name'cropped_at'type'datetime'nullabletrue)]
  55.     private $croppedAt;
  56.     /**
  57.      * @var datetime
  58.      */
  59.     #[ORM\Column(name'deleted_at'type'datetime'nullabletrue)]
  60.     private $deleteAt;
  61.     #[ORM\Column(name'print_quality'type'integer'nullabletrue)]
  62.     private ?int $printQuality null;
  63.     #[ORM\ManyToMany(targetEntityGallery::class, mappedBy'images')]
  64.     private $galleries;
  65.     private int $rotation;
  66.     #[ORM\Column(type'boolean'nullabletrue)]
  67.     private $communicationPrint;
  68.     #[ORM\ManyToMany(targetEntityImgPublication::class, inversedBy'images')]
  69.     private $imgPublications;
  70.     #[ORM\Column(name'generique_id'type'string'nullabletrue)]
  71.     private ?string $generiqueId null;
  72.     public function __construct()
  73.     {
  74.         $this->imgPublications = new ArrayCollection();
  75.         $this->createdAt = new \DateTime("now");
  76.         $this->galleries = new ArrayCollection();
  77.     }
  78.     public function toArray()
  79.     {
  80.         return [
  81.             'id' => $this->id,
  82.             'name' => $this->name,
  83.             'logo' => $this->logoDefault,
  84.             'profile' => $this->profileDefault,
  85.             'adherent' => $this->adherent,
  86.             'active' => $this->active,
  87.             'generique_id' => $this->generiqueId,
  88.             'type' => ($this->type) ? $this->type->getName() : 'A définir'
  89.         ];
  90.     }
  91.     public function getImgPublications()
  92.     {
  93.         return $this->imgPublications;
  94.     }
  95.     public function addImgPublication(ImgPublication $imgPublication): self
  96.     {
  97.         if (!$this->imgPublications->contains($imgPublication)) {
  98.             $this->imgPublications[] = $imgPublication;
  99.         }
  100.         return $this;
  101.     }
  102.     public function removeImgPublication(ImgPublication $imgPublication): self
  103.     {
  104.         if ($this->imgPublications->contains($imgPublication)) {
  105.             $this->imgPublications->removeElement($imgPublication);
  106.         }
  107.         return $this;
  108.     }
  109.     /**
  110.      * Get id.
  111.      *
  112.      * @return int
  113.      */
  114.     public function getId()
  115.     {
  116.         return $this->id;
  117.     }
  118.     /**
  119.      * Set adherent.
  120.      *
  121.      * @param string $adherent
  122.      *
  123.      * @return Image
  124.      */
  125.     public function setAdherent($adherent)
  126.     {
  127.         $this->adherent $adherent;
  128.         return $this;
  129.     }
  130.     /**
  131.      * Get adherent.
  132.      *
  133.      * @return string
  134.      */
  135.     public function getAdherent()
  136.     {
  137.         return $this->adherent;
  138.     }
  139.     /**
  140.      * Set name.
  141.      *
  142.      * @param string $name
  143.      *
  144.      * @return Image
  145.      */
  146.     public function setName($name)
  147.     {
  148.         $this->name $name;
  149.         return $this;
  150.     }
  151.     /**
  152.      * Get name.
  153.      *
  154.      * @return string
  155.      */
  156.     public function getName()
  157.     {
  158.         return $this->name;
  159.     }
  160.     /**
  161.      * Set extension.
  162.      *
  163.      * @param string $extension
  164.      *
  165.      * @return Image
  166.      */
  167.     public function setExtension($extension)
  168.     {
  169.         $this->extension $extension;
  170.         return $this;
  171.     }
  172.     /**
  173.      * Get extension.
  174.      *
  175.      * @return string
  176.      */
  177.     public function getExtension()
  178.     {
  179.         return $this->extension;
  180.     }
  181.     /**
  182.      * Set weight.
  183.      *
  184.      * @param string|null $weight
  185.      *
  186.      * @return Image
  187.      */
  188.     public function setWeight($weight null)
  189.     {
  190.         $this->weight $weight;
  191.         return $this;
  192.     }
  193.     /**
  194.      * Get weight.
  195.      *
  196.      * @return string|null
  197.      */
  198.     public function getWeight()
  199.     {
  200.         return $this->weight;
  201.     }
  202.     /**
  203.      * Set width.
  204.      *
  205.      * @param string|null $width
  206.      *
  207.      * @return Image
  208.      */
  209.     public function setWidth($width null)
  210.     {
  211.         $this->width $width;
  212.         return $this;
  213.     }
  214.     /**
  215.      * Get width.
  216.      *
  217.      * @return string|null
  218.      */
  219.     public function getWidth()
  220.     {
  221.         return $this->width;
  222.     }
  223.     /**
  224.      * Set height.
  225.      *
  226.      * @param string|null $height
  227.      *
  228.      * @return Image
  229.      */
  230.     public function setHeight($height null)
  231.     {
  232.         $this->height $height;
  233.         return $this;
  234.     }
  235.     /**
  236.      * Get height.
  237.      *
  238.      * @return string|null
  239.      */
  240.     public function getHeight()
  241.     {
  242.         return $this->height;
  243.     }
  244.     /**
  245.      * Set alt.
  246.      *
  247.      * @param string|null $alt
  248.      *
  249.      * @return Image
  250.      */
  251.     public function setAlt($alt null)
  252.     {
  253.         $this->alt $alt;
  254.         return $this;
  255.     }
  256.     /**
  257.      * Get alt.
  258.      *
  259.      * @return string|null
  260.      */
  261.     public function getAlt()
  262.     {
  263.         return $this->alt;
  264.     }
  265.     /**
  266.      * Set quality.
  267.      *
  268.      * @param string|null $quality
  269.      *
  270.      * @return Image
  271.      */
  272.     public function setQuality($quality null)
  273.     {
  274.         $this->quality $quality;
  275.         return $this;
  276.     }
  277.     /**
  278.      * Get quality.
  279.      *
  280.      * @return string|null
  281.      */
  282.     public function getQuality()
  283.     {
  284.         return $this->quality;
  285.     }
  286.     /**
  287.      * Set profileDefault.
  288.      *
  289.      * @param bool|null $profileDefault
  290.      *
  291.      * @return Image
  292.      */
  293.     public function setProfileDefault($profileDefault null)
  294.     {
  295.         $this->profileDefault $profileDefault;
  296.         return $this;
  297.     }
  298.     /**
  299.      * Get profileDefault.
  300.      *
  301.      * @return bool|null
  302.      */
  303.     public function getProfileDefault()
  304.     {
  305.         return $this->profileDefault;
  306.     }
  307.     /**
  308.      * Set active.
  309.      *
  310.      * @param bool $active
  311.      *
  312.      * @return Image
  313.      */
  314.     public function setActive($active)
  315.     {
  316.         $this->active $active;
  317.         return $this;
  318.     }
  319.     /**
  320.      * Get active.
  321.      *
  322.      * @return bool
  323.      */
  324.     public function getActive()
  325.     {
  326.         return $this->active;
  327.     }
  328.     /**
  329.      * Set original.
  330.      *
  331.      * @param string|null $original
  332.      *
  333.      * @return Image
  334.      */
  335.     public function setOriginal($original null)
  336.     {
  337.         $this->original $original;
  338.         return $this;
  339.     }
  340.     /**
  341.      * Get original.
  342.      *
  343.      * @return string|null
  344.      */
  345.     public function getOriginal()
  346.     {
  347.         return $this->original;
  348.     }
  349.     /**
  350.      * Set commentaire.
  351.      *
  352.      * @param string $commentaire
  353.      *
  354.      * @return Image
  355.      */
  356.     public function setCommentaire($commentaire)
  357.     {
  358.         $this->commentaire $commentaire;
  359.         return $this;
  360.     }
  361.     /**
  362.      * Get commentaire.
  363.      *
  364.      * @return string
  365.      */
  366.     public function getCommentaire()
  367.     {
  368.         return $this->commentaire;
  369.     }
  370.     /**
  371.      * Set type.
  372.      *
  373.      * @param int|null $type
  374.      *
  375.      * @return Image
  376.      */
  377.     public function setType($type null)
  378.     {
  379.         $this->type $type;
  380.         return $this;
  381.     }
  382.     /**
  383.      * Get type.
  384.      *
  385.      * @return int|null
  386.      */
  387.     public function getType()
  388.     {
  389.         return $this->type;
  390.     }
  391.     /**
  392.      * @return datetime
  393.      */
  394.     public function getCreatedAt(): \DateTime
  395.     {
  396.         return $this->createdAt;
  397.     }
  398.     /**
  399.      * @param datetime $createdAt
  400.      */
  401.     public function setCreatedAt(\DateTime $createdAt): void
  402.     {
  403.         $this->createdAt $createdAt;
  404.     }
  405.     public function isDeleted(): bool
  406.     {
  407.         return $this->deleted;
  408.     }
  409.     public function setDeleted(bool $deleted): void
  410.     {
  411.         $this->deleted $deleted;
  412.     }
  413.     /**
  414.      * @return datetime
  415.      */
  416.     public function getDeleteAt(): \DateTime
  417.     {
  418.         return $this->deleteAt;
  419.     }
  420.     /**
  421.      * @param datetime $deleteAt
  422.      */
  423.     public function setDeleteAt(\DateTime $deleteAt): void
  424.     {
  425.         $this->deleteAt $deleteAt;
  426.     }
  427.     /**
  428.      * @return \DateTime
  429.      */
  430.     public function getCroppedAt(): ?\DateTime
  431.     {
  432.         return $this->croppedAt;
  433.     }
  434.     public function setCroppedAt(\DateTime $croppedAt): void
  435.     {
  436.         $this->croppedAt $croppedAt;
  437.     }
  438.     public function getPrintQuality(): int
  439.     {
  440.         return $this->printQuality;
  441.     }
  442.     public function setPrintQuality(int $printQuality): void
  443.     {
  444.         $this->printQuality $printQuality;
  445.     }
  446.     public function __toString(): string
  447.     {
  448.         return $this->name;
  449.     }
  450.     /**
  451.      * @return bool|null
  452.      */
  453.     public function getLogoDefault()
  454.     {
  455.         return $this->logoDefault;
  456.     }
  457.     /**
  458.      * @param bool|null $logoDefault
  459.      */
  460.     public function setLogoDefault($logoDefault)
  461.     {
  462.         $this->logoDefault $logoDefault;
  463.     }
  464.     public function getDimensions()
  465.     {
  466.         return $this->getWidth() . ' x ' $this->getHeight();
  467.     }
  468.     /**
  469.      * @return Collection|Gallery[]
  470.      */
  471.     public function getGalleries(): Collection
  472.     {
  473.         return $this->galleries;
  474.     }
  475.     public function addGallery(Gallery $gallery): self
  476.     {
  477.         if (!$this->galleries->contains($gallery)) {
  478.             $this->galleries[] = $gallery;
  479.             $gallery->addImage($this);
  480.         }
  481.         return $this;
  482.     }
  483.     public function removeGallery(Gallery $gallery): self
  484.     {
  485.         if ($this->galleries->removeElement($gallery)) {
  486.             $gallery->removeImage($this);
  487.         }
  488.         return $this;
  489.     }
  490.     /**
  491.      * @return int
  492.      */
  493.     public function getRotation(): int
  494.     {
  495.         return $this->rotation;
  496.     }
  497.     /**
  498.      * @param int $rotation
  499.      */
  500.     public function setRotation(int $rotation): void
  501.     {
  502.         $this->rotation $rotation;
  503.     }
  504.     /**
  505.      * @return mixed
  506.      */
  507.     public function getCommunicationPrint()
  508.     {
  509.         return $this->communicationPrint;
  510.     }
  511.     /**
  512.      * @param mixed $communicationPrint
  513.      */
  514.     public function setCommunicationPrint($communicationPrint): void
  515.     {
  516.         $this->communicationPrint $communicationPrint;
  517.     }
  518.     /**
  519.      * @return string|null
  520.      */
  521.     public function getGeneriqueId(): ?string
  522.     {
  523.         return $this->generiqueId;
  524.     }
  525.     /**
  526.      * @param string|null generique_id
  527.      */
  528.     public function setGeneriqueId(?string $generiqueId): void
  529.     {
  530.         $this->generiqueId $generiqueId;
  531.     }
  532. }