DBDataObject backlinks
| From: | Alessandro Pasotti | Date: | Mon, 03 Oct 2005 07:55:25 +0000 |
| Subject: | DBDataObject backlinks | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-21203@lists.php.net to get a copy of this message | ||
Hello,
I have another question:
is there a way with DBDataObject to easily filter a dataset given a value in a
(back)linked table?
I mean:
[person] [department] [dept_pers]
pers_id PK dept_id PK pers_id FK
name name dept_id FK
I want to get all all persons in a given dept.
I know DBDataObject handles easily direct joins, but how to do in this case?
SQL would probably be
select person.* from person, dept_pers where dept_pers.dept_id = 1 and
dept_pers.pers_id = person.pers_id;
The problem is that the modules I'm working on are "table" oriented, i.e. the
DataObject class I'm working in this case would be "person" and not
"dept_pers", is there a way to get the tables that link _to_ a given table?
Thank you for helping.
--
Alessandro Pasotti
ICQ# 245871392
Linux User #167502