Active Records in 2.0
#1
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?
#2
Posted 07 April 2012 - 03:50 PM
You also may look at the Doctrine 2. I think it's pretty match to your requests.
#3
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.
Support me on Patreon: https://www.patreon.com/yiiframework
Promover Yii Framework en Español en Patreon: https://www.patreon....yiiframework_es
YiiFramework en Español: http://yiiframework.es/ - Canal de YouTube - Facebook
Follow me: @robregonm.
#4
Posted 11 April 2012 - 03:07 AM


Quote
#5
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)
#6
Posted 11 April 2012 - 02:26 PM
#7
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.
Gravity4
#8
Posted 13 April 2012 - 04:26 PM
#9
Posted 14 April 2012 - 03:27 AM
#10
Posted 14 April 2012 - 08:50 AM
#11
Posted 14 April 2012 - 10:21 AM
iScotts, on 06 April 2012 - 06:28 AM, said:
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.
#12
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).