Doctrine 2 (Symfony) Result set mapping with custom field is always null
<p>I'm performing the following native query in Symfony 2 repository:</p>

<pre><code>$sql = "SELECT f.id, f.title, 'hi' AS custom_field FROM my_feed f";

$em = $this-&gt;getEntityManager();
$rsm = new \Doctrine\ORM\Query\ResultSetMapping($em);
$rsm-&gt;addEntityResult('MedicalCoreBundle:Feed', 'f');
$rsm-&gt;addFieldResult('f', 'id', 'id');
$rsm-&gt;addFieldResult('f', 'title', 'title');
$rsm-&gt;addFieldResult('f', 'custom_field', 'custom_field');

$query = $em-&gt;createNativeQuery($sql, $rsm);
$result = $query-&gt;getResult();
</code></pre>

<p>I have created the non-mapped property <code>custom_field</code> and its getter and setter <code>getCustomField</code> and <code>setCustomField</code> in the <code>Feed</code> entity.</p>

<p>Mapped fields are hydrated properly but when i add the <code>custom_field</code> RSM i get the following error: <code>Notice: Undefined index: custom_field [...] in symfony\..\AbstractHydrator.php</code>.</p>

<p>Entity code</p>

<pre><code>// non mapped field
private $custom_field;

public function getCustomField()
{
    return $this-&gt;custom_field;
}

public function setCustomField($number)
{
    $this-&gt;custom_field = (int) $number;

    return $this;
}
</code></pre>

<p>What am i doing wrong here ?</p>