Improvements to DF_Model_result
What I did
- Implemented setting of the base model class, and populating data, at instantiation time.
- Implemented three options for choosing the base model class:
- Specified at result object instantiation time
- Configured in result class
- Automatically derived from our model/result naming convention
Implications
- The population of data currently uses a simplistic approach — should really use the table map. Will probably update this later.
- Had to add the
is_model_loaded()
method to our loader subclass, as CodeIgniter doesn't supply this for models, and it proved resistant to other approaches.
Setup
None
How to test
- Code review.
- Test with commit
b41cfaf344d6a68743e6d3e828bcd50ccf9510cf
on Art Money- Note the changes in that commit.
- Go to the admin screen for an active loan.
- Add new payments to the bottom of the list.
- Confirm that they save, and that the screen refreshes correctly.
- Try using the other methods of setting the base model class, and add temporary debugging into
_set_base_model()
inDF_Model_result
to confirm that those options are used and the tests still work. - Try using this approach in another project.
- Try and break it!