Symfony 2 The referenced column name id has to be a primary key column
<p>Having failed to find a suitable answer to this, I am posting here. Although, this message makes little sense since there is no referenced column called id here.</p>

<p>I'm referencing an existing OpenCart 1.5 database but with additional entities specific for the Symfony 2 CRM that's hooked up to it. The mappings are extremely tricky to master in this case but there's one which I cannot figure out.</p>

<blockquote>
  <ul>
  <li>The referenced column name 'id' has to be a primary key column on the target entity class 'AppBundle\Entity\Oc49Language'.</li>
  </ul>
</blockquote>

<p>Oc49Language is an existing OpenCart entity, but there is no column called <code>id</code>, only <code>language_id</code> - and there is no mention of <code>id</code> in the entity itself, nor any mappings.</p>

<p>Here's the <code>Oc49Language</code> entity:</p>

<pre><code>/**
 * Oc49Language
 *
 * @ORM\Table(name="oc49_language", indexes={@ORM\Index(name="name", columns={"name"})})
 * @ORM\Entity(repositoryClass="AppBundle\Entity\Repository\Oc49LanguageRepository")
 */
class Oc49Language
{
    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=32, nullable=false)
     */
    private $name;

    /**
     * @var string
     *
     * @ORM\Column(name="code", type="string", length=5, nullable=false)
     */
    private $code;

    /**
     * @var string
     *
     * @ORM\Column(name="locale", type="string", length=255, nullable=false)
     */
    private $locale;

    /**
     * @var string
     *
     * @ORM\Column(name="image", type="string", length=64, nullable=false)
     */
    private $image;

    /**
     * @var string
     *
     * @ORM\Column(name="directory", type="string", length=32, nullable=false)
     */
    private $directory;

    /**
     * @var string
     *
     * @ORM\Column(name="filename", type="string", length=64, nullable=false)
     */
    private $filename;

    /**
     * @var integer
     *
     * @ORM\Column(name="sort_order", type="integer", nullable=false)
     */
    private $sortOrder;

    /**
     * @var boolean
     *
     * @ORM\Column(name="status", type="boolean", nullable=false)
     */
    private $status;

    /**
     * @var ArrayCollection
     *
     * @ORM\ManyToMany(targetEntity="\AppBundle\Entity\Species", inversedBy="languageName")
     */
    private $species;

    /**
     * @var integer
     *
     * @ORM\Column(name="language_id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $languageId;


    /**
     * Constructor
     */
    public function __construct()
    {
        $this-&gt;species = new ArrayCollection();
    }
.... etc.
</code></pre>

<p>I also see an ORMException message in console when trying to validate:</p>

<blockquote>
  <p>Column name <code>id</code> referenced for relation from
  AppBundle\Entity\Oc49Language towards AppBundle\Entity\Species does
  not exist.</p>
</blockquote>

<p>Which is true - it doesn't exist; but there is also no reference to it either!</p>

<p>Am I missing something really obvious here or is it something a little more complex? This is the final mapping error out of all I was trying to fix but this one is really baffling me, so any help appreciated.</p>

<p>EDIT: as requested, this is the Species Entity:</p>

<pre><code>&lt;?php

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * Species
 *
 * @ORM\Table(name="species")
 * @ORM\Entity(repositoryClass="AppBundle\Entity\Repository\SpeciesRepository")
 */
class Species
{
    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=45, nullable=true)
     */
    private $name;

    /**
     * @var string
     *
     * @ORM\Column(name="note", type="text", nullable=true)
     */
    private $note;

    /**
     * @var integer
     *
     * @ORM\Column(name="language_id", type="text", nullable=false)
     */
    private $languageId;

    /**
     * @var \AppBundle\Entity\Oc49Language
     *
     * @ORM\OneToMany(targetEntity="\AppBundle\Entity\Oc49Language", mappedBy="species")
     */
    private $languageName;

    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\OneToMany(targetEntity="AppBundle\Entity\Breed", mappedBy="species" )
     */
    private $breed;

    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Pet", inversedBy="species" )
     */
    private $pet;

    /**
     * @var \Doctrine\Common\Collections\Collection
     *
     * @ORM\OneToMany(targetEntity="AppBundle\Entity\Illness", mappedBy="species")
     */
    private $illness;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this-&gt;breed = new ArrayCollection();
        $this-&gt;pet = new ArrayCollection();
        $this-&gt;illness = new ArrayCollection();
    }

    ...
}
</code></pre>