Home > Backend Development > PHP Tutorial > Yii source code interpretation-MVCModel

Yii source code interpretation-MVCModel

WBOY
Release: 2016-07-29 08:58:03
Original
1164 people have browsed it

The very common MVC pattern will not be explained in detail here. Let’s talk about Model in detail.

Model should concentrate the data and business logic of the entire application

All business objects involved in the application should be abstracted into Models as much as possible.

To publish an article: Post::create(), to delete a comment: Comment::delete().

The basic Model must be refined

In the design of the Model, it must be designed with as small a granularity as possible. The smaller the granularity, the higher the possibility of reuse.

Design Model hierarchically

Use inheritance to design a Model that better meets business requirements.

Be thoughtful about naming each Model!

Reference

  1. You know.

The above has introduced the Yii source code interpretation-MVCModel, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template