<?php
namespace Boab\CmsBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Boab\CmsBundle\Contract\ThumbnailInterface;
use Boab\CmsBundle\Contract\ThumbnailTrait;
/**
* User
*
* @ORM\Table(name="photos")
* @ORM\Entity(repositoryClass="Boab\CmsBundle\Repository\PhotoRepository")
*/
class Photo implements PhotoInterface, ThumbnailInterface
{
use ThumbnailTrait;
/**
* @var integer
*
* @ORM\Column(name="id", type="integer", precision=0, scale=0, nullable=false, unique=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var \Invetico\AlbumBundle\Entity\Album
*
* @ORM\ManyToOne(targetEntity="Boab\CmsBundle\Entity\Content", inversedBy="photos")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="content_id", referencedColumnName="id", nullable=true)
* })
*/
private $content;
/**
* @ORM\Column(type="string", length=100, nullable=true)
*/
private $title;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $createdAt;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
/**
* Set content
*
* @param \Boab\CmsBundle\Entity\Content $content
*
* @return Photo
*/
public function setContent(\Boab\CmsBundle\Entity\Content $content = null)
{
$this->content = $content;
return $this;
}
/**
* Get content
*
* @return \Boab\CmsBundle\Entity\Content
*/
public function getContent()
{
return $this->content;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getThumbnailPath(): ?string
{
return $this->getContent()->getId().'/'.$this->thumbnail;
}
}