https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39190
--- Comment #162 from Tomás Cohen Arazi (tcohen) <[email protected]> --- Created attachment 185995 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185995&action=edit Bug 39190: Fix polymorphic object creation in Koha::Objects This patch fixes polymorphic object creation by ensuring all methods in Koha::Objects that instantiate objects pass the DBIC result to the object_class() method for proper polymorphic resolution. Fixed methods: - find(): Now passes $result to object_class($result) - next(): Now passes $result to object_class($result) - _wrap(): Now passes $_ to object_class($_) in map This enables polymorphic classes like Koha::File::Transports to return the correct subclass (Koha::File::Transport::SFTP, Koha::File::Transport::FTP) based on the transport field value, instead of always returning the base Koha::File::Transport class. To test: 1. Apply the regression tests patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/File/Transports.t \ t/db_dependent/Koha/File/Transport/SFTP.t => FAIL: Tests fail! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi <[email protected]> -- You are receiving this mail because: 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/
