I’m working with models in CodeIgniter. However, models in CodeIgniter are quite different than ones from Java (Spring, Struts). In my understanding, model is basically DAO in CodeIgniter and you don’t have models like JavaBeans from Java (it basically contains getters and setters for every single attributes and that’s it, furthermore, it implements serializable).
What would be the way to separate DAO and DTO in CodeIgniter?
You are correct. A model in CodeIgniter corresponds to a DAO in Java. From CodeIgniter documentation:
I have noticed that there is no clear distinction between DAO and DTO. The functions usually return arrays rather than DTO. You will usually query the datastore with the tools provided by Active Record. The most common consumer of the returned data is a view. It makes it very easy to output the data by simply passing the array to the view.
Here is an example of a CI model from a CI application: https://github.com/ci-bonfire/Bonfire/blob/develop/bonfire/modules/users/models/user_model.php