Model(s) for one business logic with few database tables - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: Model(s) for one business logic with few database tables (/showthread.php?tid=76155) |
Model(s) for one business logic with few database tables - rmilecki - 04-17-2020 I use CodeIgniter 4 and I really like its Model class with all CRUD helpers. My problem is I don't know how to design model(s) for business logic that uses multiple database tables. Let's say I want to handle meetings - each having a list of subjects to discuss. My database tables look like this (simplified): Code: CREATE TABLE meetings ( This would be very convenient to have two models like this: PHP Code: class MeetingsModel extends Model As far as I understand some people find above an anemic domain model anti-pattern and they claim it should not be used. Single business logic (e.g. handling meetings) should be implemented with a single model. Do you have any suggestions on how to handle such cases in a clean way and without re-implementing code that Model already provices? |