Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Created December 13, 2015 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doctrinebot/125e146e07f067cf1614 to your computer and use it in GitHub Desktop.
Save doctrinebot/125e146e07f067cf1614 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-1161 - https://github.com/doctrine/doctrine2/issues/1763
<?php
namespace NCMS\Common\ContentBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="content")
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="class", type="string")
* @ORM\DiscriminatorMap({
"Page" = "NCMS\ContentType\PageBundle\Entity\Page",
"Article" = "NCMS\ContentType\ArticleBundle\Entity\Article",
})
*/
class Content {
/** @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue
*/
protected $id;
/** @ORM\Column(type="text")
* @Assert\NotBlank()
*/
protected $name;
/** @ORM\Column(type="integer")
* @Assert\NotBlank()
*/
protected $status;
/**
* @ORM\OneToOne(targetEntity="Content",cascade={"none"})
*/
protected $parent;
}
<?php
namespace NCMS\ContentType\PageBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="page")
*/
class Page extends Content
{
/** @ORM\Column(type="text") */
protected $meta;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment