NDB is rewriting values for same named columns in join

4 years ago

meridius
Member | 34
+
0
-

Consider having two tables

A       B
--      --
id      id
name    a_id

When I do

$a = $db->table('A')->where(':B.name = ?', 'something')->fetch();
$a->id;

I get value from B.id instead of A.id as I would expect.
This is happening for all columns with the same names in both tables.

Am I doing something wrong or is it a bug in Nette\Database?

4 years ago

vvoody
Member | 911
+
0
-

cant reproduce this bug

http://prntscr.com/6vzl33 – structure
http://prntscr.com/6vzlpg – data a table
http://prntscr.com/6vzlt5 – data b table
http://prntscr.com/6vzla4 – code
http://prntscr.com/6vzlev – response