The ActiveRecord of Yii should be a higher abstraction of the YIIDao layer. But when does YIIDao use AR?

Source: Internet
Author: User
I have just read the operations on the database of Yii. One is to use native YIIDAo and the other is Yii AR technology. Who usually uses more in actual development? The two methods provided by yii are somewhat confusing. I have just read the operations on the database of Yii. One is to use native YIIDAo and the other is Yii AR technology. Who usually uses more in actual development? The two methods provided by yii are somewhat confusing.

Reply content:

I have just read the operations on the database of Yii. One is to use native YIIDAo and the other is Yii AR technology. Who usually uses more in actual development? The two methods provided by yii are somewhat confusing.

In short, the pursuit of rapid development with AR, and the pursuit of operational efficiency with DAO. These two products are of different levels, which can be understood as cPython and C ++. When you ask this question, you do not understand that AR is a magic horse. ActiveRecord is a design model. Its direct purpose is not to operate the database, but a data model, is a more advanced abstraction of data. DAO is basically the Yii encapsulation of native PDO and has some special features.

In actual development, AR should be used more. However, some developers tend to give priority to efficiency and use native products for everything. However, they do not feel convenient to use Yii. Therefore, I have no accurate answer to this question. It is best to have fun with both of them. Naturally, they have their own preferences. However, I personally feel that AR can be used to grasp the essence of Yii and learn about ActiveForm, form verification, and other functions.

Use DOA for complex business logic, and AR for reverse

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.