2010年8月11日星期三

Re: [fw-db] Re: Db_Table createRow() & duplicate keys


On Aug 7, 2010, at 5:00 PM, Brad Waite wrote:

So I create and populate a row with data that is not unique, then save.
The save will toss an exception, and while the idea is to trap that
exception, don't I still need to find & fetch the row, update the data &
then save()?

I could do a "manual" update on the parent Table object, but that seems
to defeat the purpose of the Row.  Or am I missing how Table_Row is
supposed to be used?

There will always be outside cases that you have to code yourself.  The mission of a framework like Zend Framework is to strike a balance between speeding development in the 80% most common cases while allowing users to handle the other 20% of cases manually.  There's no way a framework can or should handle every case, because the framework would become too complex and bulky.  The framework designers try to find a good compromise between utility and simplicity.

Compared to other database abstraction layers, Zend_Db has a small code footprint.  So it naturally performs less magic for you, with the benefit that it's leaner.  Compare:

Hibernate: 874K lines of Java
https://www.ohloh.net/p/hibernate/analyses/latest

Doctrine: 220K lines of PHP
https://www.ohloh.net/p/doctrine/analyses/latest

Zend_Db: 19K lines of PHP (plus 27K lines of PHP in tests)

Regards,
Bill Karwin

没有评论: