[Rt-devel] Re: RT::Attribute::Name Unimplemented
in RT::Attributes error
Stephen Turner
sturner at MIT.EDU
Wed Dec 21 20:26:32 EST 2005
At Wednesday 12/21/2005 06:49 PM, Joby Walker wrote:
>We are using attributes for a bunch of saved resources (Searches,
>Reports (Statistics like graphs), scheduled reports, etc) and our custom
>stuff will occasionally exhibit the Attributes error -- even with the
>DBIx::SearchBuilder "fix" (removing the line).
>
>Today I extended RT::Attributes to remove the caching and made it
>similar to the other collection classes. I have yet to see a failure --
>but there is a lot more testing to do.
Hi Joby,
I think this causes other problems - I tried it myself earlier and although
I didn't see the error, the data I got back wasn't what I wanted.
When you do Object->Attributes->Named('ddd') then the Attributes object is
cached in the Object (see Record.pm). By limiting the Attributes object to
just the ones that match the name (below), the cached object's attributes
are now limited and subsequent calls to Object->Attributes will get you
just those with the name you used before, not all the attributes.
Steve
>Attributes_Local.pm
>----------------------------------------------------------------
>package RT::Attributes;
>
>use strict;
>no warnings qw(redefine);
>
>sub _DoSearch {
> my $self = shift;
> $self->SUPER::_DoSearch();
>}
>
>sub Named {
> my $self = shift;
> my $name = shift;
> $self->Limit(FIELD => 'Name',
> OPERATOR => '=',
> VALUE => $name);
> $self->_DoSearch();
>
> my @attributes;
> while (my $attr = $self->Next) {
> push (@attributes, $attr);
> }
> return @attributes;
>}
>return 1;
>----------------------------------------------------------------
More information about the Rt-devel
mailing list