{"id":824,"date":"2015-03-05T17:15:45","date_gmt":"2015-03-05T16:15:45","guid":{"rendered":"http:\/\/webpiraten.de\/?p=824"},"modified":"2015-04-23T20:33:00","modified_gmt":"2015-04-23T18:33:00","slug":"symfony2-doctrine-table-join-ohne-relation","status":"publish","type":"post","link":"https:\/\/webpiraten.de\/index.php\/frameworks\/symfony2-doctrine-table-join-ohne-relation\/","title":{"rendered":"Symfony2 Doctrine Table Join ohne Relation"},"content":{"rendered":"<p>Wer in Doctrine Tabellen joinen m\u00f6chte ohne das diese durch Entity Relationen definiert sind, kann folgenderma\u00dfen vorgehen:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\r\n    public function getInvoicesNotInElster()\r\n    {\r\n        $query = $this-&gt;em-&gt;createQueryBuilder()\r\n            -&gt;select('i')\r\n            -&gt;from('AcmeAppBundle:Invoice', 'i')\r\n            -&gt;leftJoin('AcmeAppBundle:Elster', 'e', 'WITH', 'e.number = i.number_origin')\r\n            -&gt;where('i.cancelled = 0')\r\n            -&gt;andWhere('e.number IS NULL')\r\n            -&gt;getQuery();\r\n\r\n        return $query-&gt;getResult();\r\n    }\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Wer in Doctrine Tabellen joinen m\u00f6chte ohne das diese durch Entity Relationen definiert sind, kann folgenderma\u00dfen vorgehen: public function getInvoicesNotInElster() { $query = $this-&gt;em-&gt;createQueryBuilder() -&gt;select(&#8218;i&#8216;) -&gt;from(&#8218;AcmeAppBundle:Invoice&#8216;, &#8218;i&#8216;) -&gt;leftJoin(&#8218;AcmeAppBundle:Elster&#8216;, &#8218;e&#8216;, &#8218;WITH&#8216;, &#8218;e.number = i.number_origin&#8216;) -&gt;where(&#8218;i.cancelled = 0&#8216;) -&gt;andWhere(&#8218;e.number IS NULL&#8216;) -&gt;getQuery(); return $query-&gt;getResult(); }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53,3,11,5,567],"tags":[40,296,573,569,574,39,570,575,38,572,299,571],"class_list":["post-824","post","type-post","status-publish","format-standard","hentry","category-doctrine-orm","category-frameworks","category-mysql","category-php","category-symfony2","tag-builder","tag-doctrine","tag-dql","tag-join","tag-left-join","tag-query","tag-relation","tag-right-join","tag-sql","tag-symfony","tag-table","tag-without"],"_links":{"self":[{"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/posts\/824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/comments?post=824"}],"version-history":[{"count":2,"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/posts\/824\/revisions"}],"predecessor-version":[{"id":830,"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/posts\/824\/revisions\/830"}],"wp:attachment":[{"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/media?parent=824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/categories?post=824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webpiraten.de\/index.php\/wp-json\/wp\/v2\/tags?post=824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}