On 13/10/2006, at 7:42 AM, Abu Hurayrah (FW) wrote:
Ooooooohhhhh....this is looking good (after reading the explanation
here: http://framework.zend.com/wiki/display/ZFMLGEN/mail/1625). I
would really like to see this going hand-in-hand with my previous
proposal of making Zend_Db_Table_Rowset an implementation of the
ArrayAccess interface. Then you could have the individual elements
of the Rowset be instances of your extended Zend_Db_Table_Row
object...
Am I proposing insanity?
Well... maybe? :p
FWIW I am using this exact code in a project currently nearing
production and it is working insanely well! I know that in-database
joins work well for 'flat' views of data, but this proposed
functionality makes manipulating my business models so much more
flexible and intuitive.
With this enhancement and the removal of camelcaps fieldnames the DB
libraries are getting close to (IMO) the right balance of simplicity
and flexibility.
My other quick set of wishlists would be:-
- Allowing a Zend_Db_Table to modify the database structure on one or
more columns.
e.g.
$table = new Mytable;
$table->updateColumn('description', 'varchar', array('length' =>
255));
$table->addKey('id', array('type' => 'primary'));
$table->alter();
Perhaps this could be an extension of Zend_Db_Table
(Zend_Db_Table_Schema?) that provides table manipulation methods only?
- Allowing comparisons of Zend_Db_Table objects to view discrepancies
in definitions. Much like 'diff' except you can resolve either column
definitions, data or both. The 'source' table acts as the blueprint
and the target is the one that gets updated. This would be truly
invaluable in an environment where multiple test/development
databases can start to pile on structural differences to the
production database. Could belong above?
- pre Insert hooks for Zend_Db_Table / Update for Zend_Db_Table_Row
(much like the project that Gavin provided a link to) that can
manipulate array data before the operation. Useful for timestamps,
removing non-existent column keys, etc.
--
Simon Mundy | Director | PEPTOLAB
""" " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654
4124
http://www.peptolab.com