I have an MVC application in PHP. My 'M' includes Domain Objects, Factories and Mappers. The Model is accessed via a Service layer.
Obviously my Mappers use the Factories to create objects upon retrieval from the database. But should the Factories also create the objects for all 'new' entities, e.g. for new Users?
I think the answer is Yes, but just want to check. I would use the Factories to supply default values as one of their tasks.
As a side point: is there any terminology to distinguish between 'new' entities, versus those that are retrieved from the database? (I don't like using 'new', since the new keyword precedes all object instances, even those based on data retrieved from the database).
Yes. Certainly. Factories should create objects for new entities. This is what the factory pattern is for. As a side, consider a Fibonacci sequence for formatting non-data intensive entities.