[rt-users] array of users from Users object
Thomas Sibley
trs at bestpractical.com
Wed Aug 22 11:57:06 EDT 2012
On 08/22/2012 08:23 AM, Gergely Buday wrote:
> Hi there,
>
> how can I create an array of User objects from a Users object?
>
> I do
>
> my $group = RT::Group->new($ticket->OwnerObj);
> $RT::Logger->info("OnCreate: group->Name=" . $group->Name);
> $group->LoadUserDefinedGroup($name);
> $RT::Logger->info("OnCreate: group->Name=" . $group->Name);
>
> my @groupmembers = $group->UserMembersObj;
>
> but that does not seem to work.
UserMembersObj gets you, as doc'd, an RT::Users object. If you want an
array, you should then call ->ItemsArrayRef on the RT::Users object
(which is a general collection method from DBIx::SearchBuilder).
my @groupmembers = @{ $group->UserMembersObj->ItemsArrayRef };
More information about the rt-users
mailing list