http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11518

--- Comment #4 from Kyle M Hall <[email protected]> ---
In the future we could even override $item->itype() to return the correct value
via system preference. Not sure if this would be a good idea or a bad one. In
some cases it would likely eliminate accidental bugs. From the DBIC FAQ:

How do I override a run time method (e.g. a relationship accessor)?
If you need access to the original accessor, then you must "wrap around" the
original method. You can do that either with Moose::Manual::MethodModifiers or
Class::Method::Modifiers. The code example works for both modules:

package Your::Schema::Group;
use Class::Method::Modifiers;

# ... declare columns ...

__PACKAGE__->has_many('group_servers', 'Your::Schema::GroupServer',
'group_id');
__PACKAGE__->many_to_many('servers', 'group_servers', 'server');

# if the server group is a "super group", then return all servers
# otherwise return only servers that belongs to the given group
around 'servers' => sub {
    my $orig = shift;
    my $self = shift;

    return $self->$orig(@_) unless $self->is_super_group;
    return $self->result_source->schema->resultset('Server')->all;
};

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to