I have a factory class I'm making in PHP. Each instance represents a row from a database table.
Since I'll be dealing with dozens of database rows, it would be silly to have each instance do a select on instantiation. So I have a method to just dump values in to the object, for use in conjunction with a database query that returns a lot of rows.
But from time to time, I'll also want to have the object look up all the values in a query. So, I'll have another method that takes the primary key as an argument, and looks up the values from a database query.
So it seems that between these two methods, I won't really need a __construct
method.
Is there a name for this type of pattern, more specific than 'factory'? What should I call these two different methods for constructing the object -- are there commonly used names for these methods?