Q:

Doctrine Query on Many to One relationship

In my Padel project on Symfony2 I have a Competition - Registration relationship
On the "Competition" entity:
 /**
 * @ORM\OneToMany(targetEntity="Registration", mappedBy="competition")
 */
protected $registrations;

On the "Registration" entity:
/**
 * @ORM\ManyToOne(targetEntity="PadelSchedule\UserBundle\Entity\User", inversedBy="registrations")
 * @ORM\JoinColumn(name="idPlayer", referencedColumnName="id")
 */
private $player;

/**
 * @ORM\ManyToOne(targetEntity="Competition", inversedBy="registrations")
 * @ORM\JoinColumn(name="idCompetition", referencedColumnName="id")
 */
private $competition;

Something like this.  What I need to do is, having the id of the player, get a list of the competitions on which this player is registered. 
The close thing that I have get is using a join with this query:
    $qb = $em->createQueryBuilder()
            ->select('r, c')
            ->from('PadelScheduleMainBundle:Registration', 'r')
            ->leftJoin('r.competition', 'c')
            ->where('r.player = :idPlayer')
            ->setParameter('idPlayer', $idPlayer);

But as it seems by the error I get, what I think I get through this is a list of Registrations with the competition joined, but I need for my view is a list of "Competition" objects. 
Any help?  Thanks! 

A:

Since you select from your Registration entity you get a result of Registrations.  Maybe you have better luck using a query like this:
$em->createQueryBuilder()
    ->select('c')
    ->from('PadelScheduleMainBundle:Competition', 'c')
    ->innerJoin('c.registrations', 'r')
    ->where('r.player = :player')
    ->setParameter('player', $playerId)

