Answer the question
In order to leave comments, you need to log in
Is it normal for an ActiveRecord model to be a model factory?
Good day.
There is a general Stats model, and there are submodels that describe a specific entity (ServiceOneStats, ServiceTwoStats). I consider it incorrect to share, tk. entity type is the same - statistics. Each of the models has its own table. I would like to get an instance of the Stats model with a certain type, so that I can immediately access the data of the submodel.
Some pseudocode below.
$StatsModel = new Models\Stats(1, 'service-one');
$StatsModel->serviceOneField;
$StatsModel = new Models\Stats(2, 'service-two');
$StatsModel->serviceTwoField;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question