You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Days ago I was working on a problem with the new instances returned by methods that call related elements in models in this publication
I have found a simple way to solve this problem by implementing a simple interface in the classes of models that we want to reuse globally in our applications
My Propose
Change _reusable protected property to static in Model Manager_reusable property must remain as it is
Modify how the model manager obtains the unique key of the models. Source
if reusable {
if referencedModel instanceof ReusableInterface {
let uniqueKey = referencedModel->getUniqueKey();
} else {
let uniqueKey = unique_key(referencedModel, arguments);
}
let records =this->getReusableRecords(referencedModel, uniqueKey);
iftypeof records =="array"||typeof records =="object" {
return records;
}
}
Context
Days ago I was working on a problem with the new instances returned by methods that call related elements in models in this publication
I have found a simple way to solve this problem by implementing a simple interface in the classes of models that we want to reuse globally in our applications
My Propose
Change_reusable
protected property to static in Model Manager_reusable
property must remain as it isReusableInterface
Usage
Well I hope your comments on the matter. I hope I have been explicit enough in my idea
Rgds
The text was updated successfully, but these errors were encountered: