NYCPHP Meetup

NYPHP.org

[zendframework] a modeling question

David Mintz david at davidmintz.org
Tue Jun 2 12:09:28 EDT 2009


On Tue, Jun 2, 2009 at 11:46 AM, Michael Hernandez
<mhernandez at techally.com>wrote:

> On Tue, 2009-06-02 at 11:36 -0400, David Mintz wrote:
> > At
> >
> http://framework.zend.com/docs/quickstart/create-a-model-and-database-tableyou see they use a DataMapper class to map the domain object to the
> database. My question is, if you are totally certain that the back end you
> will be using will be a database (indeed, a MySQL database) now and forever,
> do you really need that extra layer?
> >
> > --
> > David Mintz
> > http://davidmintz.org/
> >
> > The subtle source is clear and bright
> > The tributary streams flow through the darkness
>
> I found the extra layer to prove useful when I realized that my User
> model needed to make use of multiple tables. I was able to update my
> model to use multiple table objects when necessary. If you were going to
> write all the SQL yourself instead of using the methods that
> Zend_Db_Table provides, I guess it wouldn't matter as much?
>
>
Well, I would ask, is it a crime to have some SQL in your model class --
again, assuming you're comfortable committing yourself to a db for
persistence? Also, we can make use of Zend_Db_Table's (and ..._Row)'s
higher-level methods (find(), save()) and keep the raw SQL to a minimim,
possibly zero.


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

The subtle source is clear and bright
The tributary streams flow through the darkness
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/zendframework/attachments/20090602/12efccba/attachment.html>


More information about the zendframework mailing list