title: Doctrine "has no association named"
body: <p>Add me to the list of people who can't work out what's wrong with their Doctrine mapping.  I'm modelling a Chess <code>Game</code> with OneToMany <code>Halfmoves</code> - any ideas?</p>
  
  <p>DDL:</p>
  
  <pre><code>create table game ( game_id int primary key  ); 
  create table halfmove(halfmove_id int primary key, game_id int);
  </code></pre>
  
  <p>Game.php:</p>
  
  <pre><code>/**
  * Game
  *
  * @ORM\Table(name="game")
  * @ORM\Entity
  */
  class Game  
  {
  /**
   * @ORM\OneToMany(targetEntity="Halfmove", mappedBy="game")
   */
  private $halfmoves;
  
  public function getHalfmoves(){
      return $this-&gt;halfmoves;
  }
  
  public function setHalfmoves($halfmoves){
      $this-&gt;$halfmoves = $halfmoves;
  }
  
  public function __construct()
  {
      $this-&gt;halfmoves = new ArrayCollection();
  }
  ...
  </code></pre>
  
  <p>Halfmove.php:</p>
  
  <pre><code>/**
   * Halfmove
   *
   * @ORM\Table(name="halfmove")
   * @ORM\Entity
   */
  class Halfmove
  {
  /**
   * @var integer
   *
   * @ORM\Column(name="game_id", type="integer", nullable=true)
   */
  private $gameId;
  
  
  /**
   * @ORM\ManyToOne(targetEntity="Game", inversedBy="halfmoves")
   * @ORM\JoinColumn(name="game_id", referencedColumnName="game_id")
   */
  private $game;
  
  public function getGame(){
      return $this-&gt;game;
  }
  
  public function setGame($game){
      $this-&gt;game = $game;
  }
  ...
  </code></pre>
  
  <p>Query that generates error:</p>
  
  <pre><code>    $em = $this-&gt;getDoctrine()-&gt;getManager();
      $query = $em
      -&gt;createQuery(
              'SELECT p, c FROM AppBundle:Halfmove p
          JOIN p.Game c
          WHERE c.game_id = :id'
              )-&gt;setParameter('id', 3525);
      $result =  $query-&gt;getSingleResult();
  </code></pre>
  
  <p>Error message:</p>
  
  <blockquote>
    <p>2016-11-28 12:46:46] request.CRITICAL: Uncaught PHP Exception
    Doctrine\ORM\Query\QueryException: "[Semantical Error] line 0, col 62
    near 'c           ': Error: Class AppBundle\Entity\Halfmove has no
    association named Game" at
    /Users/cats/Sites/chess-ui/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php
    line 63 {"exception":"[object]
    (Doctrine\ORM\Query\QueryException(code: 0): [Semantical Error]
    line 0, col 62 near 'c\n          ': Error: Class
    AppBundle\Entity\Halfmove has no association named Game at
    /Users/cats/Sites/chess-ui/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:63,
    Doctrine\ORM\Query\QueryException(code: 0): SELECT p, c FROM
    AppBundle:Halfmove p\n            JOIN p.Game c\n            WHERE
    c.game_id = :id at
    /Users/cats/Sites/chess-ui/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:41)"}
    []</p>
  </blockquote>