Using Yii without ActiveRecord or ORM

Guys, I’ve been looking at using Yii as it’s quite nice, but it really shits me to use ActiveRcord or ORM as both are very limiting in being able to create a rather complex application which is what I’m doing. ActiveRecord just doesn’t very well when I have data for a single entity distributed between multiple tables, while ORM seems like a real bastard when it comes to performance, plus you need to learn pretty much a new language rather than just using SQL. Can anyone comment if it’s even worth me trying to use Yii without using ActiveRecord/ORM because if I can’t I may as well just stick to good old CodeIgniter.

What is the problem with records distributed between multiple tables? There is CActiveRecord::HAS_ONE relation allowing to easily get related records in one query:




MyClass::model()->with('foo', 'bar')->findByPk($pk)



ActiveRecord can’t limit you, you can always extend and override it’s methods, but it can do much boring work in an easy way. Of course, it is slower than plain sql queries, but you didn’t say anything about performance :)

Using Yii doesn´t force you to use ActiveRecord. You can always write your own SQL-Queries if you like.

Well, performance is certainly of the major considerations for me, which is the main reason I don’t particularly want to use ActiveRecord or ORM. I’ve always been against ORM because of that reason and because I don’t feel the need to learn yet another query language when SQL does a mighty fine job for me. The thing I really don’t like about ActiveRecord is how you tend to pull the entire record from the DB as well. I know many people swear by ActiveRecord but I just don’t think it’s the answer to all the world’s problems, especially if you’re looking for a high performance application. I found that with Yii even if you’re using direct queries but with ActiveRecord class you still end up loading 2000 odd lines of code, which is not so good if you don’t have opcode caching enabled on a shared server. Ultimately, I’ve always been more than happy to write SQL queries, so don’t feel the need to switch to using ORM as in my experience ORM has always had a negative performance impact.