2009年7月8日星期三

Re: [fw-db] Is the use of setIntegrityCheck(false) a good practice in classes extending Zend_Db_Table_Abstract ?

> I do this same way, but I wonder is there a way to join tables with this
> security check?

The integrityCheck is primarily for when you are joining tables
actually. By disabling it, you are basically opt-ing into usage that is
advanced, ie: the ability to return columns/fields that are not part of
the primary table that the select object came from.

example here:
http://framework.zend.com/manual/en/zend.db.table.html#zend.db.table.qry.rows.set.refine.example

>> I was wondering if the following kind of class is a good way to achieve
>> that :

Its an interesting question, V, if you are using Zend_Db_Table directly
as a model, then you've already subscribed to a modeling system that is
very much 'database' oriented. This means your API for your model is
also database centric, and having these joins is ok. On the other hand,
if you were to go with a different modeling approach like Domain Model,
or Table Module (something a little more data source agnostic, then it
would not make sense to allow that kind of direct usage as part of the API.)

Keep in mind, Zend_Db_Table (either as a model or simply as a data
access tool), is just that- a tool. As long as your usage is clearly
documented and consistent throughout a project, everything should be OK.

-ralph

没有评论: