lib/boab/cms-bundle/src/Entity/Photo.php line 16

Open in your IDE?
  1. <?php
  2. namespace Boab\CmsBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Boab\CmsBundle\Contract\ThumbnailInterface;
  5. use Boab\CmsBundle\Contract\ThumbnailTrait;
  6. /**
  7.  * User
  8.  *
  9.  * @ORM\Table(name="photos")
  10.  * @ORM\Entity(repositoryClass="Boab\CmsBundle\Repository\PhotoRepository")
  11.  */
  12. class Photo implements PhotoInterfaceThumbnailInterface
  13. {
  14.     use ThumbnailTrait;
  15.     /**
  16.      * @var integer
  17.      *
  18.      * @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false)
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="IDENTITY")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @var \Invetico\AlbumBundle\Entity\Album
  25.      *
  26.      * @ORM\ManyToOne(targetEntity="Boab\CmsBundle\Entity\Content", inversedBy="photos")
  27.      * @ORM\JoinColumns({
  28.      *   @ORM\JoinColumn(name="content_id", referencedColumnName="id", nullable=true)
  29.      * })
  30.      */
  31.     private $content;
  32.     /**
  33.      * @ORM\Column(type="string", length=100, nullable=true)
  34.      */
  35.     private $title;
  36.     /**
  37.      * @ORM\Column(type="datetime", nullable=true)
  38.      */
  39.     private $createdAt;
  40.     /**
  41.      * Get id
  42.      *
  43.      * @return integer 
  44.      */
  45.     public function getId()
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getTitle(): ?string
  50.     {
  51.         return $this->title;
  52.     }
  53.     public function setTitle(?string $title): self
  54.     {
  55.         $this->title $title;
  56.         return $this;
  57.     }
  58.     /**
  59.      * Set content
  60.      *
  61.      * @param \Boab\CmsBundle\Entity\Content $content
  62.      *
  63.      * @return Photo
  64.      */
  65.     public function setContent(\Boab\CmsBundle\Entity\Content $content null)
  66.     {
  67.         $this->content $content;
  68.         return $this;
  69.     }
  70.     /**
  71.      * Get content
  72.      *
  73.      * @return \Boab\CmsBundle\Entity\Content
  74.      */
  75.     public function getContent()
  76.     {
  77.         return $this->content;
  78.     }    
  79.     public function getCreatedAt(): ?\DateTimeInterface
  80.     {
  81.         return $this->createdAt;
  82.     }
  83.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  84.     {
  85.         $this->createdAt $createdAt;
  86.         return $this;
  87.     }
  88.     public function getThumbnailPath(): ?string
  89.     {
  90.         return  $this->getContent()->getId().'/'.$this->thumbnail;
  91.     }
  92. }