Skip to content

Loading…

DDC-614: Multiple Entities in FROM clause throws exception #5122

Closed
doctrinebot opened this Issue · 4 comments

2 participants

@doctrinebot

Jira issue originally created by user andyajadeh:

When I query,

SELECT k, d FROM OneMind\Domain\Sales\Kendaraan k, OneMind\Domain\Sales\DeliveryOrder d

it raises exception:

SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "d1_" 
LINE 1: ...gan AS pelanggan8, k0*.keterangan AS keterangan9, d1*.id AS ... ^ 

then I try to var_dump the sql:

SELECT k0*.id AS id0, k0_.tipe_kendaraan AS tipe_kendaraan1, k0_.warna AS warna2, k0_.no_rangka AS no*rangka3,
 k0*.no_mesin AS no_mesin4, k0_.tahun AS tahun5, k0_.rrn AS rrn6, k0_.salesman AS salesman7, k0*.pelanggan AS 
pelanggan8, k0*.keterangan AS keterangan9, d1_.id AS id10, d1_.nomor AS nomor11, d1*.tanggal AS tanggal12, 
d1*.kode_supplier AS kode_supplier13, d1_.tipe_kendaraan AS tipe_kendaraan14, d1*.warna AS warna15, 
d1*.no_rangka AS no_rangka16, d1_.no_mesin AS no_mesin17, d1_.tahun AS tahun18, d1_.harga_beli AS harga*beli19, 
d1*.no_sap AS no_sap20, d1_.tgl_sap AS tgl_sap21, d1_.dpp AS dpp22, d1_.ppn_masuk AS ppn_masuk23, d1*.bunga 
AS bunga24, d1*.jatuh_tempo AS jatuh_tempo25, d1_.rrn AS rrn26 FROM kendaraan k0*

Only the first entity appears in SQL FROM clause. The second one is missing. It is likely affect JOIN as well.

@doctrinebot

Comment created by felixjendrusch:

PDOException

SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "t2*" LINE 1: ...N terminal_file t1_ ON f0_.id = t1_.file_ref AND (t2*.id IN ... ^'

Join

                        $qb->innerJoin('f.terminals', 'cts', Expr\Join::WITH,
                                $qb->expr()->in('cts.terminalRef.id', array_map(function($value) {
                                    return (integer) $value;
                                }, (array) $value)));

DQL

SELECT f FROM [...]\File f INNER JOIN f.terminals cts WITH cts.terminalRef.id IN(5) [...]

SQL

SELECT [...] FROM file f0* INNER JOIN terminal_file t1_ ON f0_.id = t1_.file_ref AND (t2_.id IN (5)) INNER JOIN terminal t2_ ON t1_.terminal_ref = t2*.id [...]
@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-BETA3 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.