https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39488
Martin Renvoize (ashimema) <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |Koha's object framework now release notes| |supports polymorphic | |classing, allowing | |different object subclasses | |to be instantiated based on | |field values in shared | |database tables. | | | |This enhancement updates | |`Koha::Object` and | |`Koha::Objects` classes to | |pass the original | |`DBIx::Class` result object | |to the `object_class` | |method, enabling dynamic | |class selection based on | |record content. This works | |across all standard | |retrieval methods including | |`find`, `find_or_create`, | |`single`, `next`, `last`, | |and `as_list`. | | | |**Use cases:** | | | |- Transport protocols | |(FTP/SFTP) sharing a common | |table but requiring | |protocol-specific methods | |- Account lines where | |debits and credits share a | |table but need | |type-specific behaviour | |- Any scenario where | |related object types share | |storage but require | |distinct method | |implementations | | | |**For developers:** | | | |To implement polymorphic | |classes, define a | |`_polymorphic_class_map` | |method in your | |`Koha::Objects` class that | |returns a hashref mapping | |field values to class | |names. The framework will | |automatically instantiate | |the appropriate subclass | |based on the stored data. | | | |A template for implementing | |polymorphic classes is | |included in the codebase. | |Test::Builder has also been | |updated to introspect | |polymorphic class maps for | |comprehensive testing. -- 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/
