https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35228

--- Comment #2 from Marcel de Rooy <[email protected]> ---
While researching, I looked at this condition in _handle_to_api_child:
        Koha::Exception->throw( "Asked to embed $curr but its return value
doesn't implement to_api" )
            if defined $next and blessed $child and !$child->can('to_api');
At first glance, it sounds good. But it actually does nothing. To_api is
inherited from Koha::Object. So you 'can' do it.
In this case you will get what you want. See below. At a higher level TO_JSON
gets the details and to_api doesnt complain.
use Modern::Perl; use Data::Dumper qw/Dumper/; use Koha::Patron::Attribute;
my $child = Koha::Patron::Attribute->new({ code => 'TEST', attribute => '123'
}); print Dumper( $child->can('to_api'), $child->to_api );
$VAR1 = sub { "DUMMY" };
$VAR2 = {           'type' => 'TEST',            'value' => '123'          };

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://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