« Return to Thread: New ideas/questions for Zend_Db_Table

Re: New ideas/questions for Zend_Db_Table

by dinok :: Rate this Message:

Reply to Author | View in Thread

Matthew Weier O'Phinney-3 wrote:
You may want to look at the work Simon Mundy is doing. He's adding
support for Zend_Db_Select in Zend_Db_Table, and part of this is the
ability to return result sets from JOINs.
This is currently not possible :(
See:
http://www.nabble.com/Re%3A-revised-Zend-Db-Table-and-JOINs-t4737221s16154.html

Matthew Weier O'Phinney-3 wrote:
If you do this, it should be optional. I know many situations where I
only use the related table data in a fraction of requests to the parent
table.
Yes, of course. This is how its also implemented.
I've added the parameter 'fetchLazy' to findDependetRowsets/findParentRow methods.
Default it's set to true. This means, if a related record is not found in the $_data array, the old zf methods with find... are used. If it's set to false, the function returns (as the zf function too) null because no relations were found.

Matthew Weier O'Phinney-3 wrote:
Perhaps a factory that uses Zend_Registry for storage? This would
promote re-use, and be pretty lightweight.
Yes, exactly. This should be the fastest way and we can use just the classNames instead of the hole class reference.

Example:
Zend_Db_Table_Manger::getTable('className'): returns a classNameTable.

Zend_Db_Table_Row/Rowset->__construct(): gets just the name instead of the class

Zend_Db_Table_Row->save(): Zend_Db_Table_Manger::getTable($this->_tableName)->update/insert/delete

A possible implementation:
http://nopaste.php-quake.net/9491

 « Return to Thread: New ideas/questions for Zend_Db_Table