php - Cannot select entity through identification variables in repository -


i have following query. query inside instagramshoppicture

$querybuilder = $this->createquerybuilder('p')                     ->select('p.id, p.caption, p.price, p.lowresimageurl, p.medresimageurl, p.highresimageurl, p.numberoflikes, p.numberofdislikes, shop.id, shop.username, shop.fullname, contact, category')                     ->leftjoin('p.shop', 'shop')                     ->leftjoin('shop.contact', 'contact')                     ->leftjoin('p.category', 'category')                     ->leftjoin('category.picturetopcategory', 'picturetopcategory')                     ->leftjoin('category.picturefirstlevelcategory', 'picturefirstlevelcategory')                     ->leftjoin('category.picturesecondlevelcategory', 'picturesecondlevelcategory')                     ->where('p.islocked = false')                     ->andwhere('p.isstyleinspiration = false')                     ->andwhere('shop.islocked = false'); 

i getting following error:

queryexception: [semantical error] line 0, col -1 near 'select p.id,': error: cannot select entity through identification variables without choosing @ least 1 root entity alias 

any idea on how solve this?

after research here in came solution. try adding

->from('yourentitynameforp', 'p') ->from('yourentitynameforshop', 'shop') 

to createquerybuilder

since i'm not familiar neither symfony 2, nor doctrine 2 , trying help!

credits here: doctrine: cannot select entity through identification variables without choosing @ least 1 root entity alias


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -