php - Converting SQL query into Doctrine, Error -


i trying convert sql query doctrine querybuilder query. sql query works want within sql console (workbench). when converted ,my sql query doctrine 'query' error cannot head around.....

pure sql query:

    select  concat('news/', feeds.slug, '/', articles.slug) 'url'  article_feeds left join articles on article_feeds.article_id=articles.id left join feeds on article_feeds.feed_id=feeds.id 

doctrine query:

$stmt = $this->db->createquerybuilder()          ->select('faf.article_id', 'faf.feeds_id')          ->addselect('f.slug feedslug')          ->addselect('a.slug articleslug')          ->addselect("group_concat(distinct concat(feedslug, '/' , articleslug) separator ',' ) url")          ->from('article_feeds', 'faf')          ->leftjoin('a', 'article_feeds', 'faf', 'af.article_id = a.id')          ->leftjoin('f', 'article_feeds', 'faf', 'af.article_id = f.id');    $this->urls = $stmt->execute()->fetch(\pdo::fetch_obj); 

error:

{ code: 0, message: "the given alias 'articles' not part of or join clause table. registered aliases are: faf." } 

from understand there problem leftjoin's why , it, how fix it.....?

->leftjoin('faf.articles', 'your_articles_alias')


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -