Bug 30074: Add missing extended_attributes rs in DBIC schema

REST API route /patrons has extended_attributes available (x-koha-embed) but it's actually not working.

GET /api/v1/patrons: unhandled exception (Koha::Exceptions::BadParameter)<<Cannot find Koha::Object class for extended_attributes>> Koha::REST::Plugin::Exceptions::__ANON__ /kohadevbo
x/koha/Koha/REST/Plugin/Exceptions.pm (73)

It's missing the relationship named "extended_attributes".

Test plan:
Create a new patron attribute CODE and a value for a patron

Hit /api/v1/patrons?q={"extended_attributes.type":"CODE"}

Also:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> FAIL: Tests fail, boooo
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2022-02-10 15:28:11 +01:00 committed by Fridolin Somers
parent 2ae8d149d3
commit 78a9de0cd6

View file

@ -1908,6 +1908,13 @@ __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber");
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-09-20 12:00:15
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9g9WsdsdPINi2NP4H2A+CA
__PACKAGE__->has_many(
"extended_attributes",
"Koha::Schema::Result::BorrowerAttribute",
{ "foreign.borrowernumber" => "self.borrowernumber" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->add_columns(
'+anonymized' => { is_boolean => 1 },
'+lost' => { is_boolean => 1 },