Skip to content

Feature/df model improvements

Robert Sinton requested to merge feature/df_model_improvements into master

What I did

  • Implemented the intended behaviour of use_error_Class() and use_error_class(TRUE), to make models use DF_Model's own default error class.
  • Changed check_error() to reset the model instance's error-throwing class to its predefined default, rather than to null.
  • Also added in a reset for the logic path that ends in actually throwing an exception.
  • Added temporary storage and restoration of a model instance's error-throwing class setting in cases where DF_Model calls internal methods that involve db operations. This is because these intermediate calls will call check_error, which will reset the error-throwing class before the final/main db operation is performed.
  • Added the ability to specify an error class to use for db operations on a DF_Model_result class.

Implications

  • There may be other cases still hiding in DF_Model where it performs db operations before the main event, resulting in the error-throwing class being reset prematurely.
  • I didn't write tests for the get_with() change, but it follows the same pattern as the other changes (famous last words!)

Setup

  • Check out branch feature/use_error_classes_on_model_results from Art Money.

How to test

  • Code review of the DF_Model and DF_Model result changes.
  • Code review of the test suite added in the Art Money branch.
  • Run the test suite added in that branch and confirm that all tests pass.

Merge request reports