I read some documentations about ORM & Symfony but the English is not my mother language and maybe I miss something :) I will just make a join between reservation & spectacles I have this error :
[Semantical Error] line 0, col 70 near 'r WHERE a.id': Error: Class AppBundle\Entity\Reservation has no association named Reservation
My entities
class Reservation
{
/**
* @ORM\ManytoOne (targetEntity="AppBundle\Entity\Spectacles", inversedBy="id")
* @ORM\JoinColumn(name="id", referencedColumnName="id")
*/
private $spectacle;
}
class Spectacles
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Reservation", mappedBy="spectacle")
*
*/
private $id;
}
My repository
class ReservationRepository extends \Doctrine\ORM\EntityRepository
{
public function FindHowMunchRemains($id)
{
return $this->createQueryBuilder('a')
->join('a.Reservation','r')
->where('a.id=:id')
->setParameter('id',$id)
->getQuery()
->getResult();
}
}
EDIT:
I'am lost with ORM ;( I think it's my big issue with symfony ... I try to read doc but nothing it's clear maybe it's not my mother language.
I want to create this schema could you help me with the result of source code only on the KEY ?
See schema here under