Overall, I like most of the changes! Most of the query stuff is nice too, I think it might be easier for newcomers to understand it as well.
There are however a couple of things in this that I dislike to the point that I feel I must say so.
1) The @ and ? for the self and foreign table
First of all I think these are non-intuitive. The closest thing to intuition I can find with them is that @ can be thought of as “home” which can then be like “self”. But other than that, I can’t see how anyone thinks of “self” when they see an @, and even less how they can think of “foreign”/“the other” when they see a ?.
To compare with the Yii 1.1 way, I think “t” for the current table is much better, and I wouldn’t mind using “f” for the foreign table. This also makes one less change, why move to @ when we’re already using “t”.
Another downside to @ and ? is on a note similar to how PHP seems to be running out of special characters for their language syntax. I really hate their choice of \ as the namespace separator, I think it is insanely stupid (in the context of language syntax and as a user). I don’t know if the main reason for that choice was that it was the least bad of the few special chars they had left to choose from, but it’s something I’ve heard mentioning more than once.
In any case, instead of hogging two new special chars for the self and foreign functionality we need here, why not settle on one special char and use that as a signifier for more than one special functionality. For example; Use "@self.foo" instead of "@.foo" and "@foreign.foo" instead of "?.foo". This will let us use other @<whatever> in the future as well, if we need to, without having to figure out yet a new special char for our new purpose.
2) The new relation key syntax, "orders:Order[]"
While I can see that there is a certain value in how we as humans and used-to-PHP-syntax programmers can read that and immediately see that "orders" is a relation to multiple Order models, I think that is not worth the fact that we are taking perfectly well structured meta data/definitions from an array and squeezing it into a simple string. What I am talking about is the change from for example:
'orders'=>array(self::HAS_MANY, 'Order', 'customer_id'),
to:
'orders:Order[]'=>array(
'link'=>array('customer_id'=>'id'),
),
Sure, it is in one way more readable, but do we really want to end up with code/definitions in strings instead of in your nicely structured PHP code?
Also, we still need to use an array (because the ‘link’ option is required), so it’s not like we do this as part of being able to specify a nice array of values only, like array(‘orders:Order[]’, ‘primaryContact:Contact’). We still need the array, and all we’re doing aside from getting a little readability is lowering the amount of structured code in our application. We are practically taking some of our PHP code and putting it in a string. I just don’t think that’s a pretty thing to do.
Thanks!