<?php
namespace Cms\WorkflowsBundle\Entity\Content;
use Cms\ModuleBundle\Entity\Draft;
use Cms\Modules\SnippetBundle\Entity\Snippet\SnippetDraft;
use Cms\WorkflowsBundle\Entity\WorkflowContent;
use Doctrine\ORM\Mapping as ORM;
/**
* Class SnippetContent
* @package Cms\WorkflowsBundle\Entity\Content
*
* @ORM\Entity(
* repositoryClass = "Cms\WorkflowsBundle\Doctrine\Content\SnippetContentRepository"
* )
*/
class SnippetContent extends WorkflowContent
{
protected $contentType = WorkflowContent::CONTENT_TYPES__SNIPPET;
/**
* @var SnippetDraft
*
* @ORM\OneToOne(
* targetEntity = "Cms\Modules\SnippetBundle\Entity\Snippet\SnippetDraft"
* )
* @ORM\JoinColumn(
* name = "draftSnippet",
* referencedColumnName = "id",
* onDelete = "CASCADE"
* )
*/
protected $draft;
/**
* {@inheritdoc}
* @param SnippetDraft $value
*/
public function setDraft(Draft $value)
{
if ( ! $value instanceof SnippetDraft) {
throw new \Exception();
}
$this->draft = $value;
return $this;
}
/**
* {@inheritdoc}
* @return SnippetDraft
*/
public function getDraft()
{
return $this->draft;
}
}