one to many puzzle

26 views
Skip to first unread message

Marcello H

unread,
Mar 29, 2016, 3:35:02 AM3/29/16
to redbeanphp
So I'm writing a importer.

I have users that belong to a department, so with each user I do:

$bUser = R::load('department', $deparment_id);

Which leads to an id in the user-table. So far so good.

But now I want a list of users on my screen with their department-name next to it.

So somewhere I have:

$sql = 'inner join department on user.department_id = department.id'
$dataRecords = R::find('user', $sql);
but I don't see any of the fields back into the beans that are loaded.

when I do this sql query in phpmyadmin:
select * from users inner join department on user.department_id = department.id
I see what I need to have.

What am I missing?
Reply all
Reply to author
Forward
0 new messages