Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Validator\Constraints as Assert;
- use Gedmo\Timestampable\Traits\TimestampableEntity;
- /**
- * @ORM\Entity(repositoryClass="App\Repository\MainSliderRepository")
- */
- class MainSlider
- {
- use TimestampableEntity;
- const FILE_IMAGES_LOCATION = "/images/slider/";
- /**
- * @ORM\Id()
- * @ORM\GeneratedValue()
- * @ORM\Column(type="integer")
- */
- private $id;
- /**
- * @ORM\Column(type="string", nullable=true)
- */
- private $temponaryimage;
- /**
- * @ORM\Column(type="integer", nullable=true)
- */
- private $position;
- /**
- * @ORM\Column(type="boolean", nullable=true)
- */
- private $isPublished;
- /**
- * @ORM\Column(type="boolean", nullable=false)
- */
- private $isDeleted = false;
- /**
- * @ORM\Column(type="string", length=5, nullable=true)
- */
- private $extension;
- /**
- * @ORM\Column(type="string", nullable=true)
- */
- private $titleLabel;
- /**
- * @ORM\Column(type="string", nullable=true)
- */
- private $descriptionLabel;
- /**
- * @ORM\Column(type="string",length=255, nullable=true)
- */
- private $link;
- public function __construct()
- {
- $this->setPosition(0);
- $this->setIsPublished(true);
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getPosition(): ?int
- {
- return $this->position;
- }
- public function setPosition(?int $position): self
- {
- $this->position = $position;
- return $this;
- }
- public function getIsPublished(): ?bool
- {
- return $this->isPublished;
- }
- public function setIsPublished(?bool $isPublished): self
- {
- $this->isPublished = $isPublished;
- return $this;
- }
- public function toogleIsPublished(): ?bool
- {
- return !$this->getIsPublished();
- }
- public function getIsDeleted(): ?bool
- {
- return $this->isDeleted;
- }
- public function setIsDeleted(bool $isDeleted): self
- {
- $this->isDeleted = $isDeleted;
- return $this;
- }
- public function getExtension(): ?string
- {
- return $this->extension;
- }
- public function setExtension(?string $extension): self
- {
- $this->extension = $extension;
- return $this;
- }
- public function getTemponaryimage(): ?string
- {
- return $this->temponaryimage;
- }
- public function setTemponaryimage(string $temponaryimage): self
- {
- $this->temponaryimage = $temponaryimage;
- return $this;
- }
- public function getImageUrl($type = false)
- {
- if (!$type) {
- return self::FILES_IMAGES_LOCATION . $this->getId() . '.' . $this->getExtension();
- } else {
- return self::FILES_IMAGES_LOCATION . $this->getId() . '-' . $type . '.' . $this->getExtension();
- }
- }
- public function getTitleLabel(): ?string
- {
- return $this->titleLabel;
- }
- public function setTitleLabel(?string $titleLabel): self
- {
- $this->titleLabel = $titleLabel;
- return $this;
- }
- public function getDescriptionLabel(): ?string
- {
- return $this->descriptionLabel;
- }
- public function setDescriptionLabel(?string $descriptionLabel): self
- {
- $this->descriptionLabel = $descriptionLabel;
- return $this;
- }
- public function getLink(): ?string
- {
- return $this->link;
- }
- public function setLink(?string $link): self
- {
- $this->link = $link;
- return $this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement