Re: Re: [DB_DataObject] Struggling with n:m-relation
| From: | Alan Knowles | Date: | Thu, 03 Jun 2004 16:09:35 +0000 |
| Subject: | Re: Re: [DB_DataObject] Struggling with n:m-relation | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-12873@lists.php.net to get a copy of this message | ||
$t = DB_DataObject::factory('teacher_has_teachersubject');
$tr->joinAdd(
DB_DataObject::factory('teacher'),
'' ); // <-- '' indicates join without 'JOIN'...
$teacher->joinAdd(
DB_DataObject::factory('teachersubject'),
'' ); // <-- '' indicates join without 'JOIN'...
better join everything to t_has_ts..
Regards
alan
Marco Schuler wrote:
Hi Alan Am Do, 2004-06-03 um 16.38 schrieb Alan Knowles:-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comMarco Schuler wrote:[...]Output with DB_DataObject::Debuglevel(1); gives the following messages: teacher: ERROR: joinAdd: teachersubject has no link with teacher teacher: __find: teacher: QUERY: SELECT * FROM teacher , teacher_has_teachersubject WHERE teacher_has_teachersubject.teacher_id=teacher.teacher_id AND teacher.teacher_surname = 'SomeTeachersSurname' A $teacher->find() gives me the teachersubject_id but no data from table teachersubject is returned :-( Any idea?What I want is a query like: SELECT * from teacher, teacher_has_teachersubject, teachersubject WHERE teacher.teacher_id = teacher_has_teachersubject.teacher_id AND teacher_has_teachersubject.teachersubject_id = teachersubject.teachersubject_id AND teacher.teacher_surname = 'SomeTeachersSurname'$teacher->teacher_surname = 'SomeTeachersSurname'; $teacher->find(); use DB_DataObject::Debuglevel(1); to see what you are getting..