[rt-users] RT::Tickets vs. RT::Links
Todd Chapman
rt at chaka.net
Wed Mar 24 13:09:13 EST 2004
When working with a Ticket object I often want to
loop through all the children of a ticket or other
relationship.
$TicketObj->Members gives an appropriate RT::Links
object, but I am usually interested in only local
tickets so I have to loop through the links and
find the ones where BaseURI or TargetURI IsLocal.
my $links = $ticket->Members;
foreach (my $link = $links->Next) {
if ($link->BaseURI->IsLocal) {
my $child = $link->BaseObj;
$child->DoSomething;
}
}
Thus, it seems faster to do this:
my $children = new RT::Tickets( $ticket->CurrentUser );
$children->LimitMemberOf($ticket->Id);
foreach (my $child = $children->Next) {
$child->DoSomething;
}
This gives only local tickets.
Any words of wisdom about which way is better or
other aspects of this I have not considered?
Thanks!
-Todd
More information about the rt-users
mailing list