php - Symfony2 innerJoin is returning columns multiple time -


i'm using symfony2 application. query i'm using this:

$contents = $em->getrepository('bbdbongoappbundle:content')         ->createquerybuilder('c')         ->select('c.id, c.title, c.sequence, c.sequence_count, c.category_sequence, c.unique_id, c.priority, c.status')         ->addselect('o.slug owner')         ->addselect('cat.slug category')         ->addselect('m.name media')         ->innerjoin('c.content_owner', 'o')         ->innerjoin('c.category', 'cat')         ->innerjoin('c.media', 'm')         ->getquery()         ->getarrayresult(); 

everything before added ->innerjoin('c.media', 'm') because of content title , other returning twice if media has 2 value, i.e (youtube,website) if media has 1 value returning single result if has multiple returning multiple result.

what want single title media in single result. i.e ( titanic , youtube, web) returning (titanic, youtube, titanic, web)see titanic twice.

thanks.

with line not in object mode of doctrine.

->select('c.id, c.title, c.sequence, c.sequence_count, c.category_sequence, c.unique_id, c.priority, c.status') 

by changing code below, still have object representation:

->select('c{id,title,sequence,sequence_count,category_sequence,unique_id,priority,status}') 

source


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -