Status update: ActiveRecord
Posted 06 May 2013 - 01:51 AM
Posted 06 May 2013 - 04:17 AM
Regarding the removal of STAT, as Psih said, it doesn't belong to AR. However, considering the fact it does bring some convenience, we may support it in some different form (such as via a helper class).
@ololo: Because we now only differentiate has_one and has_many, it is necessary to specify the 'link' option. Since we have Gii, we expect much of these code will be generated automatically.
I like that new feature, and improvement for STAT more adaptive conversion from query to AR
Posted 08 May 2013 - 05:25 PM
Posted 09 May 2013 - 05:22 AM
Look at the methods "link" and "unlink" on "ActiveRecord" class
Posted 17 May 2013 - 04:16 AM
I think i've read it somewhere but i'm not sure anymore. The code seems to confirm it though: There's no JOIN query at all anymore for any relational query, is that right? Related records are always fetched through separate queries?
Posted 17 May 2013 - 05:21 AM
Yes. Usually first query is getting a list of IDs, second one is getting records themselves. That's actually a bit faster and caching-friendly.
Posted 17 May 2013 - 07:30 AM
Posted 21 June 2013 - 04:26 PM
One of the things I noticed strange in the new AR is the idea of having to use explicit joins with raw SQL when you need to filter a table through another. Would this be alleviated by the generic aliases discussed here (such as @self and @foreign)?
What's the problem with using something like ->with('relation_name') or ->together()? As a system's developer (and not Yii Core developer) I see those two approaches MUCH easier to be used, as they give more readability and flow to the AR querying code.