The main thing is to understand the kind of big project.
If your site has to handle many requests per second, probably the best choice is not even php, nor yii.
But if it is a web application where the requests per second are not excessive, all the advantages and reusability that Active Records are incomparable to direct sql.
A good way to save memory and processing time on read-only pages is to use ActiveRecord’s asArray method.
class PostController extends Controller
{
public function actionIndex()
{
$posts = Post::find()->orderBy('id DESC')->limit(100)->asArray()->all();
return $this->render('index', ['posts' => $posts]);
}
}
so I can also do this:
class Record extends ActiveRecord {
.....
public static function getAllRecords() {
return Yii::$app->db->createCommand('SELECT * FROM records')->queryAll();
}
....
}
and use it as Record::getAllRecords