php - inner-join doctrine data fetch -
i want fetch data doctrine ---
example --- (mybundle:myentityone) --- $id need find name, name connected entiry named "myentitytwo".
than (mybundle:myentitytwo) --- need find $item based on name got "myentityone".
can have idea how write query it.
what kind of relationship between entityone , entitytwo? first define relationship between them in entityone , entitytwo
on onetomany this: 1 entityone have many entitytwo use query in entityrepository on entityone:
public function findallitems() { $em = $this->getentitymanager(); $qb = $em->createquerybuilder(); $query = $qb->select("o","t") ->from($this->getentityname(), 'o') ->innerjoin("o.name","t") ; return $query->getquery()->getresult(); }
Comments
Post a Comment