How to query a parent/child relation

2 views
Skip to first unread message

GlobalSound

unread,
Dec 29, 2006, 3:04:19 AM12/29/06
to Php Object Generator
How i can query with the GetParentList the parent field and the chield
one ?

Joel

unread,
Dec 29, 2006, 3:14:13 AM12/29/06
to Php Object Generator
A parent has many children whereas a child can have only 1 parent.
Therefore, the parent can query the list of children by calling
Get{Children}List generated method.

The child, since it has only one parent, can call Get{Parent} generated
method to get the parent object.

Hope this helps

Joel

GlobalSound

unread,
Jan 11, 2007, 2:27:41 AM1/11/07
to Php Object Generator
Yes, but supposing I have a Object User (field since) with child and a
Object Login (datetime) i need to know all users in the system register
since last 10 days and how many times they logs in ...

Joel Wan

unread,
Jan 11, 2007, 2:36:50 AM1/11/07
to Php-Object...@googlegroups.com
I think you can do it in 2 steps:

$userList = $user->GetList(since = 10 days);

once you have have the userlist, you also have the login times

foreach ($userList as $user)
{
   $user->GetLoginList();
}


hope this helps
Joel
Reply all
Reply to author
Forward
0 new messages