Some questions about Yii ORM

Hi all,

I am studying the framework and have some questions about the ORM.

  1. The CActiveRecord is an object representation of a database table (as far as I understood). Is there any representation of a resultset (rowset) ? Is it possible to apply business logic on result objects by fetching, like extending Zend_Db_Table_Row_Abstract for example ?

  2. Does the framework provide methods to fetch native SQL into objects, like Doctrine for example.


Have you read the following two tutorials? They introduce the basic concepts behind Yii ORM:



  1. An AR object represents a row of table, not a whole table, in an OOP fashion.

  2. Yes.


I should have read these tutorials more thoroughly before asking questions. The answer of my first question should be afterConstruct and afterFind methods. But I didn't understand how should I transform raw SQL query into AR objects ? Is there any automated logic, or that is my responsibility ?

You can use CActiveRecord::findBySql() or findAllBySql() for your 2nd question.