[Koha-bugs] [Bug 18862] Allow relations in Koha::Object's AUTOLOAD

2017-07-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18862

Marcel de Rooy  changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 18862] Allow relations in Koha::Object's AUTOLOAD

2017-07-06 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18862

Marcel de Rooy  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 18862] Allow relations in Koha::Object's AUTOLOAD

2017-07-05 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18862

--- Comment #5 from Jonathan Druart  
---
What you pasted in comment 2 is the current way to go. I am not in favour of
adding more magic for now.
We clearly see/show what we are using and the methods are covered by tests.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 18862] Allow relations in Koha::Object's AUTOLOAD

2017-06-28 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18862

--- Comment #4 from Marcel de Rooy  ---
Any thoughts before closing this report? Jonathan?

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 18862] Allow relations in Koha::Object's AUTOLOAD

2017-06-28 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18862

--- Comment #3 from Marcel de Rooy  ---
Well, this would probably work in AUTOLOAD:

my @relations = $self->_result->relationships;
if( grep { /^$method$/ } @relations ) {
return _new_from_dbic( _guess_koha_class($method),
$self->_result->$method );
}

together with something like (maybe add check_install on the module):

sub _guess_koha_class {
my ( $self, $relation ) = @_;
my $rel_startcase = uc(substr($relation,0,1)) . substr($relation,1);
my $class_dbix = "Koha::Schema::Result::" . $rel_startcase;
my $koha_class;
if( $class_dbix->can('koha_objects_class') ) {
$koha_class = $class_dbix->koha_objects_class;
$koha_class =~ s/s$//;   # singular
$koha_class =~ s/ie$/y/; # Librarie => Library etc.
} else {
$koha_class = "Koha::" . $rel_startcase;
}
return $koha_class;
}

But I am afraid that it is not that optimal performance-wise..

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 18862] Allow relations in Koha::Object's AUTOLOAD

2017-06-28 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18862

Marcel de Rooy  changed:

   What|Removed |Added

Summary|Some DBIx relations from|Allow relations in
   |issues table do not seem to |Koha::Object's AUTOLOAD
   |work|

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/