Status update: ActiveRecord
#21
Posted 27 March 2012 - 03:42 PM
I posted with these awesome ideas in mind. I believe that they'll make it to the core. I just don't know how. Maybe you're right.
Check my extension
giix: a code generator for Yii.

The complete beginner's study guide for the Yii Framework
#22
Posted 28 March 2012 - 10:51 AM
qiang, on 27 March 2012 - 11:03 AM, said:
This would be so nice for the collection object when dealing with (and saving) related models.
Check my extension
giix: a code generator for Yii.

The complete beginner's study guide for the Yii Framework
#23
Posted 28 March 2012 - 04:59 PM
It looks like it's going to be a lot leaner, right?
In terms of performance, memory, etc. I mean.
#24
Posted 29 March 2012 - 01:34 AM
I wasn't very happy that in 1.1.x the definition of validation rules was combined with the definition of safe attributes (it was separate in 1.0.x). For big models with several scenarios it made rules() bloated. But i could override getSafeAttributeNames() to keep things a bit more separated. Will this still be possible? Or did it also change completely?
#25
Posted 29 March 2012 - 09:09 AM
@Mike: No, validation rules are largely unchanged. If you have many scenarios in a model, for better organization you could put the rules for different scenarios in different functions and then merge them in rules().
#26
Posted 30 March 2012 - 01:22 AM
qiang, on 29 March 2012 - 09:09 AM, said:
Well, that's not quite the same: I really want a separation of safe attributes from validation rules. As long as that's still possible (overriding getSafeAttributeNames or similar), i'm happy. I just don't want to list different sets of scenarios on every rule all the time as it makes my validation code very lengthy.
#27
Posted 30 March 2012 - 05:26 AM
qiang, on 29 March 2012 - 09:09 AM, said:
I've checked it, yes. That's the first thing that come up. But essentially it is PDO implementation to the letter without exposing any additional functionality to CDbConnection, so you can't use any driver-specific functionality at all. It's just a drop-in emulation if there is no PDO available.
I'm willing to try to do something about this for the Yii 2, but I need access to the source to see what can be or can't be done about it
#28
Posted 30 March 2012 - 09:05 AM
#29
Posted 30 March 2012 - 10:27 AM
#30
Posted 30 March 2012 - 11:31 AM
qiang, on 30 March 2012 - 09:05 AM, said:
Ok, i will do the work in next few week and will see if it works out fine.
#31
Posted 01 April 2012 - 05:06 AM
I like asArray() method, similar to what CakePHP is doing.
I will only miss STAT relations
#32
Posted 01 April 2012 - 07:59 AM
#33
Posted 01 April 2012 - 02:12 PM
$model->hasManyOrManyManyRelation->count();
#34
Posted 02 April 2012 - 12:39 PM
Da:Sourcerer, on 30 March 2012 - 10:27 AM, said:
Hm, actually ... Caching for active records could be implemented as a behavior this way, too.
#35
Posted 03 April 2012 - 06:44 AM
My extensions:
ActiveResource for Yii - the RESTful equivalent to ActiveRecord | Neo4Yii - wrapper for the Neo4j graph database | EPhpThumb - a simple, lightweight wrapper for the phpThumb library
Get social:
Circle me on Google Plus
Follow me on Twitter
#36
Posted 11 April 2012 - 07:05 AM
Do you think of updating the scenario logic?
For example, v1 implementation if you have a rule for the default scenario for a field as 'required' then it isn't possible to make the field not required in a custom scenario. I bumped into something like this, I simply needed the field to not be required anymore in a custom scenrario, something like 'safe' only.
Thanks.
#37
Posted 22 April 2012 - 08:38 AM
e.g.
User::find()->someScope()->anotherScope()->getDataProvider();
It would also be really useful to have an easy way of getting a data provider for related records:
$user->photos->getDataProvider(); // photos is a has_many or many_many relation
#38
Posted 22 April 2012 - 04:59 PM
#39
Posted 23 April 2012 - 02:54 AM
$dataProvider = new ActiveDataProvider($user->photos);
#40
Posted 30 April 2012 - 10:33 AM
May be the search() method could be generated working with dates, times, and datetime attributes (+ i18n) and case insensitive strings (john will return JOHN).

Help
This topic is locked
















