php - How to make a join query on Symfony with Doctrine? -


i'm kinda stuck on using querybuilder create join query. there table called "person" , table called "vacancy". if person linked vacancy person.id , vacancy.id saved in table called "candidacy". how persons linke vacancy.id 1?

so have initiate appbundle:candidacy entity?

$entity = $em     ->getrepository('appbundle:person')     ->createquerybuilder('p')     ->join('p.id', 'c')     ->where('c.vacancyid= 1')     ->getquery()     ->getresult(); 

thank in advance.

example in repository :

public function getpersonvacancy($personid) {     $qb = $this->createquerybuilder('p');     $qb->leftjoin('p.vacancy', 'v');     $qb->select('v.name', 'v.id');     $qb->where('p.id = :personid');     $qb->setparameter('personid', $personid);     return  $qb ->getquery()->getresult(); 

this give example may not work copy paste. also, join methods explained in doctrine documentation, feel free read http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/query-builder.html


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -