How you create new models for tabular input? #19279
Unanswered
WinterSilence
asked this question in
Q&A
Replies: 1 comment 6 replies
-
Why do you prefer cloning in this case? Performance or something else? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I never using
*Multiple
methods before. My back-end forms communicates with Yii application through AJAX requests to REST API. API methods work with single models(composite or not).After reading Creating a dynamic set of new records I thought: what's strange solution... why need create empty models? why not just clone prototype model?!
I look at how cloning is implemented in models and was unpleasantly surprised:
Model
remove event handlers andBehavior
s instead cloning, but other properties containing objects are ignored. Handlers/behaviours can be re-attached to cloned model without any problems.Aslo,
Model::instance()
not callsensureBehaviors()
,createValidators()
and return not completely initiated model.How do you solve such problems?
Beta Was this translation helpful? Give feedback.
All reactions