Do normal CRUD operations need to go through the business layer?

Source: Internet
Author: User
Do normal CRUD operations need to go through the business layer? The actual situation is that the create, delete, update, and find methods provided by ActiveRecord can be used to deal with common CRUD operations that need to go through the business layer?
The actual situation is that the create, delete, update, and find methods provided by Active Record can be used directly.

Reply content:

Do normal CRUD operations need to go through the business layer?
The actual situation is that the create, delete, update, and find methods provided by Active Record can be used directly.

Generally, CURD performs
S layer to do some complex things

The CRUD of a single object is implemented in DAO, and the Service layer calls these CRUD methods.

The common practice of Rails does not require the business layer.

For details, refer to the description of InitPHP framework layering:
Http://initphp.com/3_2.htm

MVC layering is a common and reasonable method for development.
The MVC layer divides the Web into three layers: model layer, control layer, and view layer.
The MVC layer separates PHP code from HTML to make the project more clean and clear.
InitPHP uses the DSCV hierarchy by default, and also supports MVC hierarchy. DSCV divides the M layer of MVC into DAO and Service layers.
To use MVC layering, you only need to directly call the InitPHP: getDao () Class in the Controller.

DSCV layers: Dao (data layer), Service (business Service layer), Controller (control layer), View (View layer)
The most important feature of DSCV layering is to separate the Model layer Model of MVC into the Dao data layer and Service layer.
The advantage of DSCV layering is to clarify the responsibilities of each layer. The data layer focuses more on Data Operations (SQL operations and cache operations), and the business service layer focuses more on providing common function interfaces for the control layer.
A Service is generally intended for businesses. For example, a user-class UserService provides interfaces such as user registration and user information modification. The Service can be called by the Controller.
The Service obtains data through Dao. A complex Service corresponds to multiple Dao.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.