R – Simplest model code

zend-framework

I am very experienced with the CakePHP framework but am checking out the Zend Framework for an application that will receive massive traffic.

I'm going through the quickstart tutorial in the documentation and got to the "Create a Model and Database Table" page.

Must I or should I create all those model classes it mentions, i.e.

application/models/DbTable/Guestbook.php
application/models/GuestbookMapper.php
application/models/Guestbook.php

Coming from CakePHP it seems like quite a lot of code for some functionality I would of thought of as quite basic and generic.

Or can I just create application/models/Guestbook.php and have it extend Zend_Db_Table_Abstract?

Any help would be much appreciated.

Best Answer

You can create your model after the DbTable class, however one of the benefits of doing a dataMapper class between your model and your DbTable class is that you can abstract more the data engine and create strong business rules.

Related Topic