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