Bringing the persistence code in the essence itself is an Active Record Pattern approach, while preserving the entire logic of saving in a separate class by the Model Exemplary approach. You can use the repository pattern vs activerecord to find more information about your issues.
For example, an active record template criticizes its testability without a database; you can refer to this for more information.
For me, I prefer the repository template more, because it can be tested and I donβt like save codes, and domian business logic is mixed in one class, which violates the emphasis on separation of problems.
source share