SOS: I'm at a loss.
I want to create a new object without knowing the class when I first go to create it. That points me towards a factory pattern; I want my controller to capture and sanitize user input, then send it to a factory to create a new object.
Based on part of the user input - specifically, a "type" value that will be chosen from a list of predefined types - I want my new object (model) to have a set of specific hardcoded variables (properties). These properties include things such as a template URL (which provides a template to format data for output (basically a view)) and a list of table names I need to gather data from.
An object of Type A might want to access tables("t_x", "t_y", "t_z") and send the data to a template at "template_a.php".
An object of Type B might want to instead access tables("t_c", "t_d") and send the data to a template at "template_b.php".
While I'm sure I could do something fancy to generate the template URLs based on the type (as long as they follow a specific naming convention), things like the table set cannot be generated automatically. I am not sure where in my application this hardcoded information needs to live / reside.
Am I on the right track using a factory pattern, where the factory would specify which class to instantiate (and the class would tell the new object to contain my hard-coded variables)?
Should I use if-else statements (ew) or switches (potentially a valid option since there will only be a handful of types to choose from)? I am new to OOP and feel a little lost, but I really dont want to leave a mess for the next guy (who might be future-me).
All guidance is appreciated. Please let me know if further clarification is needed.
Edit: I'm hoping I've found the right solution.
I think I can get the code to function as desired by using factories. I will have a general class to define which variables are needed, and then have a separate extension of that class for each different type. The sub-classes will define the variables in the __construct() function, so each new object will have the right values for its type.