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

  • SEARCH
  • Home
  • 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 7171835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:29:35+00:00 2026-05-28T15:29:35+00:00

I’m using the Zend_Db framework, and I’ve run into a snag. I’m trying to

  • 0

I’m using the Zend_Db framework, and I’ve run into a snag. I’m trying to add custom handling to the column naming at the row level, but it’s failing to invoke my function for some reason.

I’ve stripped down the problem to simply try and figure out if the underlying “Row” class is ever even created. From what I can tell, it isn’t.

Here’s what I’ve got:

// this class functions correctly; I get "table" written to my output
class DHR_Table extends Zend_Db_Table_Abstract
{
    protected $_rowClass = 'DHR_Row';

    function __construct(){
        echo "table";
        parent::__construct();
    }
}

// this class never gets called, at least not that is evident from the constructor echo
class DHR_Row extends Zend_Db_Table_Row_Abstract
{
    protected $inflector = null;

    function __construct(){
        echo "row";
        parent::__construct();
    }
}

// this is the actual implementation class that uses these two:
class Application_Model_DbTable_Applicants extends DHR_Table
{
    protected $_name = 'applicants';
}

My output includes some data (excluded from this post, but part of the “Applicants” class) and “table”, but no “row”. Any ideas why this might be happening? Version 1.11.11 of the Zend framework.

[Edit]
Here’s the usage:

class ApplicantsController extends DHR_RestController
{    
    public function indexAction()
    {
        $applicants = new Application_Model_DbTable_Applicants();
        $result = $applicants->fetchAll();
        $this->success($result);
    }
    protected function success($data, $code = 200)
    {
            if(is_a($data, 'Zend_Db_Table_Rowset')){
                    // we could do some pagination work here
                    $data = $data->toArray();
            }
            $this->setResponseCode($code)->appendBody(Zend_Json::encode(array(
                    'success'=>true,
                    'data' => $data
            )));
    }
}

I would expect to at least have some method on the row class invoked when returning the serialized results…

[Update]
If I use “fetchRow” everything works as expected; fetchAll simply does’t do the conversion to the underlying object type.

  • 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. Editorial Team
    Editorial Team
    2026-05-28T15:29:37+00:00Added an answer on May 28, 2026 at 3:29 pm

    I was just looking at the code for the row/abstract class.
    Try setting a value for $_tableClass.
    $_tableClass = 'DHR_Table';

    I’m afraid that won’t work as it looks like Zend/Db/Table/Row/Abstract.php is going to look for a table definition no matter what, so the level of abstraction you seem to be after may not be possible without further extending.

    //excerpt from __construct Zend/Db/Table/Row/Abstract.php
    
    public function __construct(array $config = array())
        {
            if (isset($config['table']) && $config['table'] instanceof Zend_Db_Table_Abstract) {
                $this->_table = $config['table'];
                $this->_tableClass = get_class($this->_table);
            } elseif ($this->_tableClass !== null) {
                $this->_table = $this->_getTableFromString($this->_tableClass);
            }
     // cont...
     // Retrieve primary keys from table schema
            if (($table = $this->_getTable())) {
                $info = $table->info();
                $this->_primary = (array) $info['primary'];
            }
    
            $this->init();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.