Status update: ActiveRecord
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.
Posted 28 March 2012 - 10:51 AM
This would be so nice for the collection object when dealing with (and saving) related models.
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?
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().
Posted 30 March 2012 - 01:22 AM
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.
Posted 30 March 2012 - 05:26 AM
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
Posted 30 March 2012 - 09:05 AM
Posted 30 March 2012 - 10:27 AM
Posted 30 March 2012 - 11:31 AM
Ok, i will do the work in next few week and will see if it works out fine.
Posted 02 April 2012 - 12:39 PM
Hm, actually ... Caching for active records could be implemented as a behavior this way, too.
Posted 03 April 2012 - 06:44 AM
ActiveResource for Yii - the RESTful equivalent to ActiveRecord | Neo4Yii - wrapper for the Neo4j graph database | EPhpThumb - a simple, lightweight wrapper for the phpThumb library
Circle me on Google Plus
Follow me on Twitter
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.
Posted 22 April 2012 - 08:38 AM
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
Posted 22 April 2012 - 04:59 PM
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).