Search and Replace in MVC
- by danip
What would be a good MVC/OOP/GRASP/SOLID structure for a search/replace functionality. Methods: search/searchNext/replace/replaceAll.
I'm interested only in the PHP arhitecture and how a professional developer would implement this in it's OWN FRAMEWORK.
What names would you use for the classes?
What subfolders would you used in your MODEL folder?
How would you connect the MODELS/CONTROLLER?
This is just a arhitecture question to understand better the principles of good OOP in practice.
My current implementation is very simplistic using a service model:
/controller/SearchReplaceController.php
/models/services/SearchReplaceService.php
The problem with this is I know I'm breaking SRP in the service but I found this somehow acceptable. Also creating a service does not feel like the best solution for this.