Skip to content

Move out Filters from Controllers to a helper / library #367

@edgarf

Description

@edgarf

Currently, filter bars are generated in each of the controllers. We want to create a library (or a helper) and put all related code inside.
The controller should have something similar to the following:
$generated_filter_data = $this->filter_helper->generate('students',$fields,$data(optional)
students = Controller
$fields = An array with field labels and titles ($fields = array ('School Year'=>"school_year", "Grade Level =>"grade_level)
$data = In some situations, we would like to have custom value lists for the fields, in that case we will define this information in this array.

The helper would need to have field value generation inside. For example, to get all of the Grade Levels? For these purposes ORM Entities should be used. This would allow us to remove all of the custom SQL code currently written in controllers.

The above is just a suggestion, all other proposals are welcome to be discussed.

Tasks
  • Create a library / helper
  • Use ORM to generate filter values inside of the library / helper
  • Clean-up code which is no longer needed in Controllers (raw sql queries)
  • Test and validate that all of the filters are functioning correctly.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions