src/Cms/WorkflowsBundle/Entity/Content/PageContent.php line 18

Open in your IDE?
  1. <?php
  2. namespace Cms\WorkflowsBundle\Entity\Content;
  3. use Cms\ModuleBundle\Entity\Draft;
  4. use Cms\Modules\PageBundle\Entity\Page\PageDraft;
  5. use Cms\WorkflowsBundle\Entity\WorkflowContent;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * Class PageContent
  9.  * @package Cms\WorkflowsBundle\Entity\Content
  10.  *
  11.  * @ORM\Entity(
  12.  *     repositoryClass = "Cms\WorkflowsBundle\Doctrine\Content\PageContentRepository"
  13.  * )
  14.  */
  15. class PageContent extends WorkflowContent
  16. {
  17.     protected $contentType WorkflowContent::CONTENT_TYPES__PAGE;
  18.     /**
  19.      * @var PageDraft
  20.      *
  21.      * @ORM\OneToOne(
  22.      *     targetEntity = "Cms\Modules\PageBundle\Entity\Page\PageDraft"
  23.      * )
  24.      * @ORM\JoinColumn(
  25.      *     name = "draftPage",
  26.      *     referencedColumnName = "id",
  27.      *     onDelete = "CASCADE"
  28.      * )
  29.      */
  30.     protected $draft;
  31.     /**
  32.      * {@inheritdoc}
  33.      * @param PageDraft $value
  34.      */
  35.     public function setDraft(Draft $value)
  36.     {
  37.         if ( ! $value instanceof PageDraft) {
  38.             throw new \Exception();
  39.         }
  40.         $this->draft $value;
  41.         return $this;
  42.     }
  43.     /**
  44.      * {@inheritdoc}
  45.      * @return PageDraft
  46.      */
  47.     public function getDraft()
  48.     {
  49.         return $this->draft;
  50.     }
  51. }