View Single Post
  #3 (permalink)  
Old 10-05-2007, 11:41 AM
Bootle Bootle is offline
Junior Member
 
Join Date: Oct 2007
Posts: 5
Default

Thanks for the reply.

How likely are you to have more than one adapter in a project? It seems the only viable use would be for different adapters to point to different databases?

With regards to my original post, i'll try and explain it a little better.

Whereas i'm currently used to creating a model, say Author, and using pdo from within the class to populate it's properties (activerecord i suppose?), after reading the docs on zend_db_table it seems that for any model in the application that requires db access, i need to make it a child of zend_db_table_row, since the gateway returns an object of that type.

eg:
PHP Code:
class Author
{
   function 
load($id){
      
$record $this->db->prepare('select * from authors where id=?'$id)->fetchRow();
      
$this->name $record['forename'] . ' ' $record['surname'];
      
$this->id $record['id'];
      
//etc

See, it's like i used to build the objects following the activerecord approach? Well that way, an author is an author. Now if i use the zf approach, it would be something like:
PHP Code:
class Author extends zend_db_table_row
{} 
is that right? Meaning that the author interface now has a load of data access methods?

Reply With Quote