M
M
Max Khartanovych2015-02-16 18:05:52
Yii
Max Khartanovych, 2015-02-16 18:05:52

Best practices for organizing large models in Yii2?

I want to ask about the best practices for organizing large models in Yii2.
1. Is it better to store your model methods in a separate class? For example:
"common/models/helpers/User extends common/models/User" What is your choice?
2. Than static methods "helpers" in models are good or bad?
3. Please share your experience in this matter :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Makarov, 2015-02-17
@maxkh

1. No. What for?
2. Good because you don't need a copy. Bad, most likely, because in a good way they do not quite relate to the model.
3. If the task is difficult, do not try to cram everything into an AR model, create your own domain layer. That is, you need to calculate the reports for the quarter, consider it a separate class. Not a model.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question