Active Records in 2.0
Posted 06 April 2012 - 06:28 AM
Im not sure if this is how redbean does this, but I imagine a ORM where you just design you classes ike you would in OOP.
you set your attributes and from there the orm will design the database for you, this way even inheritance and stuff would be easier for the developer. Now I know not all attributes are variable maybe there could be a way for us to differentiate the two for the ORM to design the correct models with correct columns in the database. This could remove the sometimes irritating task of having to decide what DB data type to use, the ORM could just set this for us, unless explicitly stated otherwise.
Do you guys think this is a good idea.. Yes? no? maybe?
Posted 10 April 2012 - 01:56 PM
I can find it in Rails, django and some other frameworks...
It would be great to have this key feature in Yii.
YiiFramework en Español - http://yiiframework.co/ - http://yiiframeworkenespanol.org/ - Yii Code Generator for Bootstrap
http://obregon.co/ - https://1server.co/
PHP 5.5+, nginx 1.7, MySQL(MariaDB & PerconaDB), PostgreSQL 9, Yii 2, CanJS
Follow me: @robregonm & @obregonco & @1ServerCo.
Posted 11 April 2012 - 05:20 AM
this ORM is a really great project and it's worth to design Yii2 so that it could be integrated with Doctrine2 with no pain, probably in form of adapter extension turning Doctrine2 into YII-like ActiveRecord (see this) so we can work with AR and still use such things as inheritance mapping and doctrine migrations like in sf2 DoctrineMigrationsBundle with its' diff which allows to keep sources and DB exactly corresponding each other (unlike Gii and its' revers engineering). I mean with Gii you sometimes have to change generated code or redeclare it in children classes (like in giix)
Posted 11 April 2012 - 11:04 PM
It is good when you don't have to take care about your database. Right now I am using database only when developing some new feature, just to check if everything is fine. There are many unit tests that we are wrote to check if our RedBeanModel elements works fine.
ReadBean database can be into two stages: frozen and unfrozen. In unfrozen stage it is possible to change db structure, and it is much slower. It is usually used in development phase of project. Once you finished development phase you need to switch it into frozen stage. Off course during schema update, it must be in unfrozen state.
You don't have to worry about migrations files. For every model we define its structure, types, elements, relations, and then we just run updateSchema command, and db is updated automatically.
Posted 13 April 2012 - 04:26 PM
Posted 14 April 2012 - 03:27 AM
Posted 14 April 2012 - 10:21 AM
I agree with you. I have used Doctrine1 & Redbeans PHP. Yii ORM is very well and enough for me. But Readbeans features should be good in Yii ORM2. Doctrine1 is big lib. Redbeans small and simple. I prefer Redbeans instead Doctrine1. I don't know Doctrine2 yet. But export/import fixtures (yaml or xml) features also good choice for Yii.
PHP, Yii, Wordpress, MySQL
Posted 16 April 2012 - 03:16 AM
The underlying query syntax (SQL vs. Map-Reduce is quite different though, while simple save/update/delete could be similar, not sure yet how a more complex retrieval interface would be).