Posted 16 October 2008 - 03:04 PM
In my active record implementation the backing table may not exist when the record is created. If the CActiveRecord.getMetaData() returned a IActiveRecordMetaData instance I can swing it by implementing my own. (Currently I can fake it by returning a class which does the same as the CActiveRecordMetaData)
I think this could be useful in some applications. Possible ?
Posted 16 October 2008 - 03:14 PM
Since CActiveRecordMetaData is mainly for internal use, exposing it as an interface may not be good as it contains many public properties which can't be declared via interface.
Posted 16 October 2008 - 03:35 PM
1) A "setup module" function is called.
2) This invokes an instance of my active record and calls the setup() function on it.
3) The setup function calls the getFields() which returns a map of the fields and some meta data about the field types.
4) The setup function then creates the table based on the information returned by getFields().
Right now step 2 fails ..
Posted 16 October 2008 - 03:59 PM
Posted 16 October 2008 - 06:09 PM
Hmm CActiveRecord is a bit different from Prados' active record so there may be an alternative way to approach this for me.
Thanks for the help I will let you know if there is an alternate approach to my issue.
Posted 20 October 2008 - 09:01 AM
This works well enough although I still think it would be useful to be able to define the table structure without having to goto the database table to fetch the column names for two reasons: 1) Performance - an array can be read from a lot quicker then a table schema, 2) Flexibility - Maybe you do not want to populate or retrieve all the fields from the table or the table does not exist yet.
Posted 20 October 2008 - 09:34 AM