vendor/fri0z/mldev-publication-bundle/src/Entity/Item.php line 19

Open in your IDE?
  1. <?php
  2. namespace MLDev\PublicationBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use MLDev\BaseBundle\Contract\SeoSite\SeoSiteInfoInterface;
  6. use MLDev\BaseBundle\Entity\Traits\Timestampable;
  7. use MLDev\BaseBundle\Annotation\Uploadable;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * Item
  11.  *
  12.  * @ORM\Table(name="MLDev_Publication_Item")
  13.  * @ORM\Entity(repositoryClass="MLDev\PublicationBundle\Repository\ItemRepository")
  14.  * @ORM\HasLifecycleCallbacks()
  15.  */
  16. class Item
  17. {
  18.     use Timestampable;
  19.     /**
  20.      * @var int
  21.      *
  22.      * @ORM\Id
  23.      * @ORM\Column(name="id", type="integer")
  24.      * @ORM\GeneratedValue(strategy="AUTO")
  25.      */
  26.     private $id;
  27.     /**
  28.      * @var string
  29.      *
  30.      * @ORM\Column(name="name", type="string", length=255)
  31.      */
  32.     private $name;
  33.     /**
  34.      * @var string
  35.      *
  36.      * @Gedmo\Slug(fields={"name"}, updatable=false, unique=true, separator="-")
  37.      * @ORM\Column(name="alias", type="string", length=255, nullable=false)
  38.      */
  39.     private $alias;
  40.     /**
  41.      * @var string|null
  42.      *
  43.      * @ORM\Column(name="annotation", type="text", nullable=true)
  44.      */
  45.     private $annotation;
  46.     /**
  47.      * @var string|null
  48.      *
  49.      * @ORM\Column(name="content", type="text", nullable=true)
  50.      */
  51.     private $content;
  52.     /**
  53.      * @var bool
  54.      *
  55.      * @ORM\Column(name="isActive", type="boolean")
  56.      */
  57.     private $isActive;
  58.     /**
  59.      * @var int
  60.      *
  61.      * @ORM\Column(name="priority", type="integer")
  62.      */
  63.     private $priority 100;
  64.     /**
  65.      * @var \DateTime
  66.      * @ORM\Column(name="date", type="datetime", nullable=true)
  67.      */
  68.     private $date;
  69.     /**
  70.      * @ORM\Column(type="string", name="image", nullable=true)
  71.      *
  72.      * @Uploadable(directoryAlias="page")
  73.      * @Assert\File(mimeTypes={"image/jpeg", "image/jpg", "image/png"})
  74.      */
  75.     private $image null;
  76.     /**
  77.      * @ORM\ManyToOne(targetEntity="\MLDev\PublicationBundle\Entity\Category", inversedBy="items")
  78.      */
  79.     private $category;
  80.     /**
  81.      * @ORM\ManyToMany(targetEntity=SeoSiteInfoInterface::class, cascade={"persist"})
  82.      * @ORM\JoinTable(
  83.      *     name="MLDev_Publication_SeoInfo",
  84.      *     joinColumns={
  85.      *          @ORM\JoinColumn(name="publication_id", referencedColumnName="id", onDelete="CASCADE")
  86.      *     },
  87.      *     inverseJoinColumns={
  88.      *          @ORM\JoinColumn(name="seo_info_id", referencedColumnName="id", onDelete="CASCADE")
  89.      *     }
  90.      * )
  91.      */
  92.     private $seoInfo;
  93.     /**
  94.      * @var string
  95.      *
  96.      * @ORM\Column(name="link", type="text", nullable=true)
  97.      */
  98.     private $link;
  99.     /**
  100.      * Get id.
  101.      *
  102.      * @return int
  103.      */
  104.     public function getId()
  105.     {
  106.         return $this->id;
  107.     }
  108.     /**
  109.      * Set name.
  110.      *
  111.      * @param string $name
  112.      *
  113.      * @return Item
  114.      */
  115.     public function setName($name)
  116.     {
  117.         $this->name $name;
  118.         return $this;
  119.     }
  120.     /**
  121.      * Get name.
  122.      *
  123.      * @return string
  124.      */
  125.     public function getName()
  126.     {
  127.         return $this->name;
  128.     }
  129.     /**
  130.      * Set alias.
  131.      *
  132.      * @param string $alias
  133.      *
  134.      * @return Item
  135.      */
  136.     public function setAlias($alias)
  137.     {
  138.         $this->alias $alias;
  139.         return $this;
  140.     }
  141.     /**
  142.      * Get alias.
  143.      *
  144.      * @return string
  145.      */
  146.     public function getAlias()
  147.     {
  148.         return $this->alias;
  149.     }
  150.     /**
  151.      * Set annotation.
  152.      *
  153.      * @param string|null $annotation
  154.      *
  155.      * @return Item
  156.      */
  157.     public function setAnnotation($annotation null)
  158.     {
  159.         $this->annotation $annotation;
  160.         return $this;
  161.     }
  162.     /**
  163.      * Get annotation.
  164.      *
  165.      * @return string|null
  166.      */
  167.     public function getAnnotation()
  168.     {
  169.         return $this->annotation;
  170.     }
  171.     /**
  172.      * Set content.
  173.      *
  174.      * @param string|null $content
  175.      *
  176.      * @return Item
  177.      */
  178.     public function setContent($content null)
  179.     {
  180.         $this->content $content;
  181.         return $this;
  182.     }
  183.     /**
  184.      * Get content.
  185.      *
  186.      * @return string|null
  187.      */
  188.     public function getContent()
  189.     {
  190.         return $this->content;
  191.     }
  192.     /**
  193.      * Set isActive.
  194.      *
  195.      * @param bool $isActive
  196.      *
  197.      * @return Item
  198.      */
  199.     public function setIsActive($isActive)
  200.     {
  201.         $this->isActive $isActive;
  202.         return $this;
  203.     }
  204.     /**
  205.      * Get isActive.
  206.      *
  207.      * @return bool
  208.      */
  209.     public function getIsActive()
  210.     {
  211.         return $this->isActive;
  212.     }
  213.     /**
  214.      * Set priority.
  215.      *
  216.      * @param int $priority
  217.      *
  218.      * @return Item
  219.      */
  220.     public function setPriority($priority)
  221.     {
  222.         $this->priority $priority;
  223.         return $this;
  224.     }
  225.     /**
  226.      * Get priority.
  227.      *
  228.      * @return int
  229.      */
  230.     public function getPriority()
  231.     {
  232.         return $this->priority;
  233.     }
  234.     /**
  235.      * @return \DateTime
  236.      */
  237.     public function getDate(): ?\DateTime
  238.     {
  239.         return $this->date;
  240.     }
  241.     /**
  242.      * @param \DateTime $date
  243.      */
  244.     public function setDate(?\DateTime $date): void
  245.     {
  246.         $this->date $date;
  247.     }
  248.     /**
  249.      * @return null
  250.      */
  251.     public function getImage()
  252.     {
  253.         return $this->image;
  254.     }
  255.     /**
  256.      * @param null $image
  257.      */
  258.     public function setImage($image): void
  259.     {
  260.         $this->image $image;
  261.     }
  262.     /**
  263.      * @ORM\PrePersist()
  264.      */
  265.     public function onPrePersistDate()
  266.     {
  267.         if ($this->date === null) {
  268.             $this->date = new \DateTime('now');
  269.         }
  270.     }
  271.     /**
  272.      * @ORM\PreUpdate()
  273.      */
  274.     public function onPreUpdateDate()
  275.     {
  276.         if ($this->date === null) {
  277.             $this->date = new \DateTime('now');
  278.         }
  279.     }
  280.     /**
  281.      * @return mixed
  282.      */
  283.     public function getCategory()
  284.     {
  285.         return $this->category;
  286.     }
  287.     /**
  288.      * @param mixed $category
  289.      */
  290.     public function setCategory($category)
  291.     {
  292.         $this->category $category;
  293.     }
  294.     /**
  295.      * @return \Doctrine\Common\Collections\ArrayCollection
  296.      */
  297.     public function getSeoInfo()
  298.     {
  299.         return $this->seoInfo;
  300.     }
  301.     /**
  302.      * @param \Doctrine\Common\Collections\ArrayCollection $seoInfo
  303.      */
  304.     public function setSeoInfo($seoInfo): void
  305.     {
  306.         $this->seoInfo $seoInfo;
  307.     }
  308.     public function getLink(): ?string
  309.     {
  310.         return $this->link;
  311.     }
  312.     public function setLink(?string $link): self
  313.     {
  314.         $this->link $link;
  315.         return $this;
  316.     }
  317. }