src/Entity/Page.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Traits\CreatedUpdatedTrait;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Sonata\TranslationBundle\Model\Gedmo\TranslatableInterface;
  8. use Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable;
  9. /**
  10.  * Page
  11.  *
  12.  * @ORM\Table(name="v_page")
  13.  * @ORM\Entity()
  14.  * @Gedmo\TranslationEntity(class="App\Entity\Translation\PageTranslation")
  15.  * @Gedmo\Loggable
  16.  */
  17. class Page extends AbstractPersonalTranslatable implements TranslatableInterface
  18. {
  19.     /**
  20.      * @var integer
  21.      *
  22.      * @ORM\Column(name="id", type="integer")
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue(strategy="AUTO")
  25.      */
  26.     private $id;
  27.     /**
  28.      * @var string
  29.      *
  30.      * @ORM\Column(name="title", type="string", length=255)
  31.      * @Gedmo\Translatable
  32.      * @Gedmo\Versioned
  33.      */
  34.     private $title;
  35.     /**
  36.      * @var string
  37.      * @Gedmo\Slug(fields={"title"}, updatable=true)
  38.      * @ORM\Column(name="slug", type="string", length=255)
  39.      * @Gedmo\Versioned
  40.      */
  41.     private $slug;
  42.     /**
  43.      * @var string
  44.      *
  45.      * @ORM\Column(name="description", type="text")
  46.      * @Gedmo\Translatable
  47.      * @Gedmo\Versioned
  48.      */
  49.     private $description;
  50.     /**
  51.      * @var boolean
  52.      *
  53.      * @ORM\Column(name="enabled", type="boolean")
  54.      * @Gedmo\Versioned
  55.      */
  56.     private $enabled;
  57.     use CreatedUpdatedTrait;
  58.     /**
  59.      * @var ArrayCollection
  60.      *
  61.      * @ORM\OneToMany(
  62.      *     targetEntity="App\Entity\Translation\PageTranslation",
  63.      *     mappedBy="object",
  64.      *     cascade={"persist", "remove"}
  65.      * )
  66.      */
  67.     protected $translations;
  68.     public function __construct()
  69.     {
  70.         $this->translations = new ArrayCollection();
  71.     }
  72.     public function __toString()
  73.     {
  74.         return (string) $this->title;
  75.     }
  76.     /**
  77.      * Get id
  78.      *
  79.      * @return integer
  80.      */
  81.     public function getId()
  82.     {
  83.         return $this->id;
  84.     }
  85.     /**
  86.      * Set title
  87.      *
  88.      * @param string $title
  89.      *
  90.      * @return Page
  91.      */
  92.     public function setTitle($title)
  93.     {
  94.         $this->title $title;
  95.         return $this;
  96.     }
  97.     /**
  98.      * Get title
  99.      *
  100.      * @return string
  101.      */
  102.     public function getTitle()
  103.     {
  104.         return $this->title;
  105.     }
  106.     public function getSlug()
  107.     {
  108.         return $this->slug;
  109.     }
  110.     /**
  111.      * Set description
  112.      *
  113.      * @param string $description
  114.      *
  115.      * @return Page
  116.      */
  117.     public function setDescription($description)
  118.     {
  119.         $this->description $description;
  120.         return $this;
  121.     }
  122.     /**
  123.      * Get description
  124.      *
  125.      * @return string
  126.      */
  127.     public function getDescription()
  128.     {
  129.         return $this->description;
  130.     }
  131.     /**
  132.      * Set enabled
  133.      *
  134.      * @param boolean $enabled
  135.      *
  136.      * @return Page
  137.      */
  138.     public function setEnabled($enabled)
  139.     {
  140.         $this->enabled $enabled;
  141.         return $this;
  142.     }
  143.     /**
  144.      * Get enabled
  145.      *
  146.      * @return boolean
  147.      */
  148.     public function getEnabled()
  149.     {
  150.         return $this->enabled;
  151.     }
  152.     /**
  153.      * @return \DateTime
  154.      */
  155.     public function getCreated()
  156.     {
  157.         return $this->created;
  158.     }
  159.     /**
  160.      * @param \DateTime $created
  161.      */
  162.     public function setCreated($created)
  163.     {
  164.         $this->created $created;
  165.     }
  166.     /**
  167.      * @return \DateTime
  168.      */
  169.     public function getUpdated()
  170.     {
  171.         return $this->updated;
  172.     }
  173.     /**
  174.      * @param \DateTime $updated
  175.      */
  176.     public function setUpdated($updated)
  177.     {
  178.         $this->updated $updated;
  179.     }
  180. }