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

            Bug ID: 36736
           Summary: Add ability to load DBIx::Class Schema files found in
                    plugins
 Change sponsored?: ---
           Product: Koha
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]

Right now, it is not possible to create custom Koha::Object(s) for a plugin
without breaking things. For example we did this:

BEGIN {
    my $path = Module::Metadata->find_module_by_name(__PACKAGE__);
    $path =~ s!\.pm$!/lib!;
    unshift @INC, $path;

    require Koha::CurbsidePickupIssues;
    require Koha::CurbsidePickupPolicies;
    require Koha::CurbsidePickups;
    require Koha::Schema::Result::CurbsidePickup;
    require Koha::Schema::Result::CurbsidePickupIssue;
    require Koha::Schema::Result::CurbsidePickupPolicy;

    # register the additional schema classes
    Koha::Schema->register_class(CurbsidePickup =>
'Koha::Schema::Result::CurbsidePickup');
    Koha::Schema->register_class(CurbsidePickupPolicy =>
'Koha::Schema::Result::CurbsidePickupPolicy');
    Koha::Schema->register_class(CurbsidePickupIssue =>
'Koha::Schema::Result::CurbsidePickupIssue');
    # ... and force a refresh of the database handle so that it includes
    # the new classes
    Koha::Database->schema({ new => 1 });
}

In the curbside pickups plugin before it was integrated. The problem we've
found is that calling Koha::Database->schema({ new => 1 }); resets the database
connection and breaks any transactions you were in when the plugin was loaded!

We should be able to search for and load any schema files found in plugin
directories to make this all unnecessary.

-- 
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