My findings in Yii and comparisons to CakePHP

Since I have found out about Yii I have been using it to work on a “dummy” website with features that are generally used across a large variety of websites (e.g. news system, user system, authorization, etc). This is also exactly what I did with CakePHP when I first started learning it, and the reason I do this is not only so I have a set of re-usable resources but also to help learn the framework. Although I still consider myself a novice in Yii I have learned a lot of things about it, some things very similar to CakePHP while other things very different. It’s a learning experience and I must say Yii so far seems a better alternative to CakePHP for many reasons. I will outline a few reasons/differences here.
PHP 5 features included in the core
First, and most importantly, what allows for most of the stuff that I love in Yii over CakePHP is that it is PHP 5 only. PHP 4 is not supported. Because of this, Yii is able to take use of many PHP 5 features that Cake is not able to. Mainly, that would be the PHP 5 magic overloading functions, which leads to the next point:
OOP style AR and lazy loading
Yii takes use of PHP 5’s overloading functions in its AR implantation in a very beautiful manner. Instead of storing results from quarries in an array as Cake does, in Yii you can access the quarries in an OOP manner. Here is an simple example of accessing AR in Yii, taken out of the Yii documentation.

//Database scheme is 'post' BELONGS_TO 'user'. Each row in the 'posts' table has a corresponding row in the 'users' table.
// retrieve the post whose ID is 10
$post = Post::model()->findByPk(10);
// retrieve the post's author: a relational query will be performed here
$user = $post->user;

Note the last line. What actually happens is that the related user data is loaded dynamically by simply calling the variable. The reason for this is because Yii takes use of lazy loading (and of course PHP 5’s magic). This means the data is not retrieved until it is actually needed, increasing performance and ease of programming. If lazy loading does not fit you, you can use eager loading too, which will work similar to Cake’s ContainableBehavior. Example:

$posts = Post::model()->with('user')->findByPk(10);

Now that is what I call beautiful code. You can probably tell what the above does implicitly, but if you can’t, it simply pulls the post with id of 10 along with its corresponding user (a mysql JOIN will be used). Beautiful? I think yes.
Excellent Documentation
And you can find that out for yourself.
Fast and useful developer feedback
Along with the documentation the Yii forum is also an excellent place to get help. I have posted a few questions/bug reports there and have gotten very fast feedback, from the lead developer himself if from no one else. The bug reports and enchantments I requested there [1, 2, 3] were all fixed/implanted within 24 hours of reporting. Therefore I give Yii two thumbs up for developer feedback. Arguably the user feedback is not as good has Cake’s user feedback however, as Cake is much more well known and more widely in use (Yii only just came out with a stable version I believe this month). But developer feedback is more valuable than user feedback in my opinion.
Integration with jQuery
Cake uses prototype. Booo!
More easily extended
One example I have for this so far and that I have tested are the validation rules. Not only can you define a action in the model as a validation as in Cake, but you can can define a whole class to be a validation type. For instance, you could create a authenticatePass class that works as a validator that you can easily drop into your projects. Then you could use it in your model as so:

public function rules() {
return array(
array('password', 'authenticatePass'),
//more rules...

The above validator could be designed to validate the password to the username (if sent) in the users table.
Regarding the design pattern
As far as the structure, e.g. the MVC design pattern, Yii and CakePHP are very similar. They both have “components” for example. Yii also has “widgets”, which can represent anything from a form calendar to a navigational menu. Widgets consist of both components and views, so in a way, they are similar to Cake’s “plugins” I suppose, but they are not so intimidating to create. Yii also has their own version of the Bakery for sharing extensions.
Since this post is quite long enough, I will stop here. In future articles I will try to focus on more narrow topics as I don’t feel this post is nearly long enough to satisfy my given subject line. Oh well. Hope you learned something useful!