Bug 17091

Summary: Add AUTOLOAD to Koha::Objects
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: brendan, hector.hecaxmmx, mtj
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17226
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 16961    
Bug Blocks: 14899, 17094, 17226, 17425, 17552, 19989    
Attachments: Bug 17091: Add AUTOLOAD to Koha::Objects
Bug 17091: Remove explicit declaration of Koha::Objects->update
Bug 17091: Remove explicit declaration of Koha::Objects->count
Bug 17091: Remove explicit declaration of Koha::Objects->pager
Bug 17091: Remove explicit declaration of Koha::Objects->reset
Bug 17091: In a first phase, restrict the usage of AUTOLOAD in Koha::Objects
[SIGNED-OFF]Bug 17091: Add AUTOLOAD to Koha::Objects
[SIGNED-OFF]Bug 17091: Remove explicit declaration of Koha::Objects->update
[SIGNED-OFF]Bug 17091: Remove explicit declaration of Koha::Objects->count
[SIGNED-OFF]Bug 17091: Remove explicit declaration of Koha::Objects->pager
[SIGNED-OFF]Bug 17091: Remove explicit declaration of Koha::Objects->reset
[SIGNED-OFF]Bug 17091: In a first phase, restrict the usage of AUTOLOAD in Koha::Objects
Bug 17091: Add delete to the Koha::Objects AUTOLOAD method
Bug 17091: Add AUTOLOAD to Koha::Objects
Bug 17091: Remove explicit declaration of Koha::Objects->update
Bug 17091: Remove explicit declaration of Koha::Objects->count
Bug 17091: Remove explicit declaration of Koha::Objects->pager
Bug 17091: Remove explicit declaration of Koha::Objects->reset
Bug 17091: In a first phase, restrict the usage of AUTOLOAD in Koha::Objects
Bug 17091: Add delete to the Koha::Objects AUTOLOAD method

Description Jonathan Druart 2016-08-09 15:12:54 UTC
Up to now if a Koha::Objects based object needs to call DBIx::Class methods, we have to create a new method for Koha::Objects, something like:
  sub method {
    my $self = shift;
    return $self->_resultset->method
  }

To simplify and ease the call to DBIx::Class method, we could create an AUTOLOAD method.
Comment 1 Jonathan Druart 2016-08-09 15:23:55 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2016-08-09 15:23:58 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2016-08-09 15:24:01 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2016-08-09 15:24:05 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2016-08-09 15:24:09 UTC Comment hidden (obsolete)
Comment 6 Jonathan Druart 2016-08-09 15:37:12 UTC Comment hidden (obsolete)
Comment 7 Héctor Eduardo Castro Avalos 2016-08-10 14:43:22 UTC
Created attachment 54272 [details] [review]
[SIGNED-OFF]Bug 17091: Add AUTOLOAD to Koha::Objects

Up to now if a Koha::Objects based object needs to call DBIx::Class methods, we
have to create a new method for Koha::Objects, something like:
  sub method {
    my $self = shift;
    return $self->_resultset->method
  }

To simplify and ease the call to DBIx::Class method, this patch defines an
AUTOLOAD to call the DBIx::Class method on the resultset we are encapsulating.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Comment 8 Héctor Eduardo Castro Avalos 2016-08-10 14:43:40 UTC
Created attachment 54273 [details] [review]
[SIGNED-OFF]Bug 17091: Remove explicit declaration of Koha::Objects->update

Test plan:
  prove t/db_dependent/Koha/Objects.t
should return green

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Comment 9 Héctor Eduardo Castro Avalos 2016-08-10 14:43:59 UTC
Created attachment 54274 [details] [review]
[SIGNED-OFF]Bug 17091: Remove explicit declaration of Koha::Objects->count

Test plan:
  prove t/db_dependent/Koha/Objects.t
should return green

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Comment 10 Héctor Eduardo Castro Avalos 2016-08-10 14:44:30 UTC
Created attachment 54275 [details] [review]
[SIGNED-OFF]Bug 17091: Remove explicit declaration of Koha::Objects->pager

Test plan:
  prove t/db_dependent/Koha/Objects.t
should return green

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Comment 11 Héctor Eduardo Castro Avalos 2016-08-10 14:44:36 UTC
Created attachment 54276 [details] [review]
[SIGNED-OFF]Bug 17091: Remove explicit declaration of Koha::Objects->reset

Test plan:
  prove t/db_dependent/Koha/Objects.t
should return green

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Comment 12 Héctor Eduardo Castro Avalos 2016-08-10 14:44:41 UTC
Created attachment 54277 [details] [review]
[SIGNED-OFF]Bug 17091: In a first phase, restrict the usage of AUTOLOAD in Koha::Objects

To make sure the methods will be covered by tests and devs won't
overused this method, I think it may be a good idea to restrict its
usage.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
AUTOLOAD added. No Koha QA errors. Test passed successfully
Comment 13 Jonathan Druart 2016-09-08 18:18:09 UTC
Created attachment 55378 [details] [review]
Bug 17091: Add delete to the Koha::Objects AUTOLOAD method

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Comment 14 Kyle M Hall 2016-10-11 09:13:42 UTC
Created attachment 56142 [details] [review]
Bug 17091: Add AUTOLOAD to Koha::Objects

Up to now if a Koha::Objects based object needs to call DBIx::Class methods, we
have to create a new method for Koha::Objects, something like:
  sub method {
    my $self = shift;
    return $self->_resultset->method
  }

To simplify and ease the call to DBIx::Class method, this patch defines an
AUTOLOAD to call the DBIx::Class method on the resultset we are encapsulating.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 15 Kyle M Hall 2016-10-11 09:14:05 UTC
Created attachment 56143 [details] [review]
Bug 17091: Remove explicit declaration of Koha::Objects->update

Test plan:
  prove t/db_dependent/Koha/Objects.t
should return green

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 16 Kyle M Hall 2016-10-11 09:14:15 UTC
Created attachment 56144 [details] [review]
Bug 17091: Remove explicit declaration of Koha::Objects->count

Test plan:
  prove t/db_dependent/Koha/Objects.t
should return green

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 17 Kyle M Hall 2016-10-11 09:14:23 UTC
Created attachment 56145 [details] [review]
Bug 17091: Remove explicit declaration of Koha::Objects->pager

Test plan:
  prove t/db_dependent/Koha/Objects.t
should return green

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 18 Kyle M Hall 2016-10-11 09:14:32 UTC
Created attachment 56146 [details] [review]
Bug 17091: Remove explicit declaration of Koha::Objects->reset

Test plan:
  prove t/db_dependent/Koha/Objects.t
should return green

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 19 Kyle M Hall 2016-10-11 09:14:39 UTC
Created attachment 56147 [details] [review]
Bug 17091: In a first phase, restrict the usage of AUTOLOAD in Koha::Objects

To make sure the methods will be covered by tests and devs won't
overused this method, I think it may be a good idea to restrict its
usage.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
AUTOLOAD added. No Koha QA errors. Test passed successfully

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 20 Kyle M Hall 2016-10-11 09:14:51 UTC
Created attachment 56148 [details] [review]
Bug 17091: Add delete to the Koha::Objects AUTOLOAD method

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 21 Brendan Gallagher 2016-10-12 10:27:33 UTC
Pushed to Master - Should be in the November 2016 release.  Thanks!
Comment 22 Mason James 2016-12-14 10:09:40 UTC
Enhancement, skipping for 16.05.x