php - How to refactor better model functions in CakePHP? -
I am studying programming best practice and it is said that when we make the function, we should do this sole solo specific task.
I have found model functions that retrieve data and this is related data. Example:
$ the-> student-> student assessments ();
Currently, this function receives student assignments, as well as questions for each assignment and data about the student. I use all of them, I have a dilemma, if I try to do different things which retrieve related data (student and question datas), then it starts doing because I call DB more I am
What would you suggest?
Take care while doing this kind of refactoring ...
I usually My models have a model-> and some more functions. These functions are public and this means that the controller is called as an option in the form of the option of finding complex (or any).
What I would normally do is then a small collection of personal works in the model.
Student-> There may be anything about scholarship ...
Student-> With the teachings of teachers
Students-> Join students Call the accession, which in turn can call the assignment-> Join Assessment Speciary etc.
Due to both the Markdown Bold things, the double underscore prefix has been removed due to both of them, unless you use "private" or "protected" keywords, if you are using php5 Underscore are not really important.
Actually I use public law as a container of a specific group. Building a Query Building or Association within Personal Model. I have an API that returns complex data, But I can create query or result set (depending on the type of data, relationships involved or understanding complexity) from small fragments - which ideally use more and more Can call a public function.
Comments
Post a Comment