On Fri, Jan 29, 2010 at 10:52 AM, Konr Ness <[email protected]> wrote:

> Why does your init need access to the model? Maybe to populate a select
> element's options?
>

Exactly.


>
> In that case, yeah, you'll probably have to set the model via the
> constructor.
>
>

Sometimes I write static methods in my Zend_Db_Table subclasses that return
arrays for populating select elements. That would seem to resolve the
problem of multiple instantiations of the same class.

Of course, static methods have no $this so you can't use the parent class'
instance methods. What I've been doing is grabbing a reference to my $db
resource out of the bootstrap (via the front controller) and running
fetchPairs() on it. Maybe it's a bit baroque but it seems to work.



-- 
Support real health care reform:
http://phimg.org/

--
David Mintz
http://davidmintz.org/

Reply via email to