activeRow joining tables problem

Notice: This thread is very old.
majky358
Member | 37
+
0
-

Hi, i have problem with ActiveRow, Nette: 2.0.14.

Problem is, i have \Nette\Database\Selection and i need data from another table via foreign key.

$this->template->data = $this->database->table('table');

{foreach $data as $d}

{$d->ref('second_table', 'table_2_id')->id} -> //works ok

{$d->second_table->id} //doesnt work, i tried it in many ways, no success

{/foreach}

Couple hours ago, i checked my database, i am not sure if there's a problem.

$d->ref(… works either…when i delete foreign key from table, it create new select (debug panel) no join or similiar stuff.

Anyway, when i proceed SHOW CREATE TABLE mytable command, i see foreign keys constraints in table, but i checked information_schema (REFERENTIAL_CONSTRAINTS, INNODB_SYS_FOREIGN, INNODB_SYS_FOREIGN_COLS) and i see no tables or columns (reference) which i have created.

TABLE_1
id int PRIMARY KEY
text varchar(255)
table_2_id

ALTER TABLE table_1
ADD FOREIGN KEY (table_2_id)
REFERENCES table_2(id)


TABLE_2
id int PRIMARY KEY
text varchar(255)

Where can be problem ? Thanks

Last edited by majky358 (2014-10-03 15:49)