Hi, I'm trying to write some code using our Koha::Schema::Result::* classes. The sample i picked was the most unfortunate: I want to pull data from Deletedbiblio and Deletedbibliotems which don't have a relation defined. The relevant bits of the code look like: my $resultset = $schema->resultset( 'Deletedbiblio' )->search( { Deletedbiblio.biblionumber => $biblionumber }, { join => [ qw/ Deletedbiblioitems Itemtypes / ] } ); it dies because "No such relationship Deletedbiblioitem on Deletedbiblio". How shuold we cope with that situation? (I understand introducing a relationship would mean a lot of trouble as the tables are intended for deleted / not hard-linked data). Any ideas? Plain SQL? Regards To+ P.S. Happy independence day for those that apply :-D -- Tomás Cohen Arazi Prosecretaría de Informática Universidad Nacional de Córdoba ✆ +54 351 5353750 ext 13168 GPG: B76C 6E7C 2D80 551A C765 E225 0A27 2EA1 B2F3 C15F
Hi On Fri, Jul 4, 2014 at 11:16 AM, Tomas Cohen Arazi <tomascohen@gmail.com> wrote:
it dies because "No such relationship Deletedbiblioitem on Deletedbiblio". How shuold we cope with that situation? (I understand introducing a relationship would mean a lot of trouble as the tables are intended for deleted / not hard-linked data).
Any ideas? Plain SQL?
Briefly, you can declare the relationship relationships in the DBIC class without there having to be a corresponding FK in the underlying SQL. That said, if this query is something that would be used frequently, adding a FK relationship would be fine, or at least an index.
P.S. Happy independence day for those that apply :-D
Thanks! Regards, Galen -- Galen Charlton Manager of Implementation Equinox Software, Inc. / The Open Source Experts email: gmc@esilibrary.com direct: +1 770-709-5581 cell: +1 404-984-4366 skype: gmcharlt web: http://www.esilibrary.com/ Supporting Koha and Evergreen: http://koha-community.org & http://evergreen-ils.org
participants (2)
-
Galen Charlton -
Tomas Cohen Arazi