Doctrine2 relation for non Id column
<p>I'm building a simple web-service using Symfony 3, Doctrine 2.5 and stuck at ORM relations described below in simplified structure.</p>

<p>I have an Action entity containing many actions with ManyToOne relation...</p>

<pre><code>class Action
{
/**
 * @ORM\Column(name="id", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="AUTO")
 */
private $id;

/**
 * @var integer
 *
 * @ORM\ManyToOne(targetEntity="\AppBundle\Entity\Status")
 * @ORM\JoinColumn(referencedColumnName="code", nullable=false)
 */
private $status;
</code></pre>

<p>and the Status Entity with a few statuses.</p>

<pre><code>class Status
{
/**
 * @ORM\Column(name="id", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="AUTO")
 */
private $id;

/**
 * @var string
 *
 * @ORM\Column(type="integer", unique=true)
 */
private $code;
</code></pre>

<p>I cannot get proper way to set referencedColumnName="code" column (not 'Id' as usual) for Action entity. </p>

<p>Configured this way repo throws wxception at persist  moment with "<strong>Notice: Undefined index: code</strong>";</p>

<p>I guess that it is mappedBy or inversedBy annotation parameter... but can't figure out "how".</p>