-- Steve Klabnik <[EMAIL PROTECTED]> wrote
(on Thursday, 06 November 2008, 09:23 AM -0500):
> On Wed, Nov 5, 2008 at 6:23 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
> wrote:
>
> There's not. I'm not entirely sure why Zend_Db_Table does not implement
> this, though my understanding is that there are some sound architectural
> reasons not to do so. I've often created such a method myself, though,
>
>
>
> Again, there's not, and again, uncertain as to why. I've often
> implemented such functionality for my own models, however.
>
>
> I'm pretty sure that Cake tries to emulate the ActiveRecord pattern,
> and Zend does not. I did a quick search, and it seems like some
> ActiveRecord-ish stuff was proposed for Zend back in 2006, but never
> took any ground?
Yes. The reason was that PHP currently does not support a pure
ActiveRecord implementation due to lack of late static binding (LSB --
which will be available in PHP 5.3.0).
What that essentially meant was that we could not do the following:
$bug = Bug::find(3);
simply by declaring the following:
class Bug extends Zend_ActiveRecord
{
}
due to the fact that 'self' always refers to the defining class, not the
class from which it was called.
ZF implements the Table Data Gateway and Row Data Gateway via
Zend_Db_Table and Zend_Db_Table_Row. These are incredibly flexible, and
do not require the use of static methods -- which allows them to bypass
LSB and simply work. RDGs are very similar to ActiveRecord in use.
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/