Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 107933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:49:55+00:00 2026-05-11T01:49:55+00:00

What are some of the ways you have implemented models in the Zend Framework?

  • 0

What are some of the ways you have implemented models in the Zend Framework?

I have seen the basic class User extends Zend_Db_Table_Abstract and then putting calls to that in your controllers:

$foo = new User;

$foo->fetchAll()

but what about more sophisticated uses? The Quickstart section of the documentation offers such an example but I still feel like I’m not getting a ‘best use’ example for models in Zend Framework. Any interesting implementations out there?


EDIT: I should clarify (in response to CMS’s comment)… I know about doing more complicated selects. I was interested in overall approaches to the Model concept and concrete examples of how others have implemented them (basically, the stuff the manual leaves out and the stuff that basic how-to’s gloss over)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:49:56+00:00Added an answer on May 11, 2026 at 1:49 am

    I personally subclass both Zend_Db_Table_Abstract and Zend_Db_Table_Row_Abstract. The main difference between my code and yours is that explicitly treat the subclass of Zend_Db_Table_Abstract as a ‘table’ and Zend_Db_Table_Row_Abstract as ‘row’. Very rarely do I see direct calls to select objects, SQL, or the built in ZF database methods in my controllers. I try to hide the logic of requesting specific records to calls for behind Zend_Db_Table_Abstract like so:

    class Users extends Zend_Db_Table_Abstract {      protected $_name = 'users';      protected $_rowClass = 'User'; // <== THIS IS REALLY HELPFUL      public function getById($id) {         // RETURNS ONE INSTANCE OF 'User'     }      public function getActiveUsers() {         // RETURNS MULTIPLE 'User' OBJECTS                 }  }  class User extends Zend_Db_Table_Row_Abstract {      public function setPassword() {         // SET THE PASSWORD FOR A SINGLE ROW     }  }  /* CONTROLLER */ public function setPasswordAction() {      /* GET YOUR PARAMS */      $users = new Users();      $user = $users->getById($id);      $user->setPassword($password);      $user->save(); } 

    There are numerous ways to approach this. Don’t think this is the only one, but I try to follow the intent of the ZF’s design. (Here are more of my thoughts and links on the subject.) This approach does get a little class heavy, but I feel it keeps the controllers focused on handling input and coordinating with the view; leaving the model to do the application specific work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 59k
  • Answers 59k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Well the first step in receiving help with a warning… May 11, 2026 at 9:01 am
  • added an answer One way might be to lie to the Entity Framework… May 11, 2026 at 9:01 am
  • added an answer I think you're confusing something there. A buffer is something… May 11, 2026 at 9:01 am

Related Questions

What are some of the ways? What frameworks can you use?
What are some of the ways you have implemented models in the Zend Framework?
What are some of the best or most popular rule engines? I haven't settled
What are some of the new features that can be used in .NET 2.0
What are some of the lesser know, but important and useful features of Windows
What are some of the better AJAX Treeviews out there that support asynchronous JSON
Besides the dynamic nature of Python (and the syntax), what are some of the
I am looking to use a javascript obfuscator. What are some of the most
What are some of techniques good for detecting if a webpage is the same
What are some software packages available to provide 90% of the avatar functionality for

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.