Skip to content

Instantly share code, notes, and snippets.

@haswalt
Created December 1, 2011 11:36
Show Gist options
  • Save haswalt/1416060 to your computer and use it in GitHub Desktop.
Save haswalt/1416060 to your computer and use it in GitHub Desktop.
Mapped Superclass example
<?php
namespace UKWM\Bundle\DictionaryBundle\Entity;
use \Doctrine\ORM\Mapping as ORM;
/**
* @ORM\MappedSuperclass
*/
class Definition
{
/**
* @ORM\Column(type="string", length="255")
*/
protected $text;
/**
* @ORM\ManyToOne(targetEntity="Definition", inversedBy="alternatives")
* @ORM\JoinColumn(name="definition_id", referencedColumnName="id")
*/
protected $alternatives;
public function __construct()
{
$this->alternatives = new \Doctrine\Common\Collections\ArrayCollection();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment