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 4552418
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:47:11+00:00 2026-05-21T16:47:11+00:00

I once posted this question, but had no answer at all, this time, the

  • 0

I once posted this question, but had no answer at all, this time, the question is best formated so It will be more easy to understand what I need.

I created a Model with Zend_Db_Table_Abstract

Add the primaryKey and the table name, all ok.

Then, I executed the code to retrieve the fonts.

$db = new App_Model_News();

$news = $db->fetchAll("visible = 1", "published_on DESC");

foreach ($news as $i => $new) {

    $images = $this->_helper->News->first_image($new);

}

This method works, but I need to retrieve two view statements:

$this->view->news = $news;
$this->view->images = $images;

What I need is to merge this two results, doing something like this.

$db = new App_Model_News();

$news = $db->fetchAll("visible = 1", "published_on DESC");

foreach ($news as $i => $new) {

    $news[$i]->images = $this->_helper->News->first_image($new);

}
$this->view->news = $news;

I’m not able to do it, because the Abstract is array associative, my Model is like this:

class App_Model_News extends Zend_Db_Table_Abstract{

    protected $_name = 'news';
    protected $_primary = 'id';

    protected $_dependentTables = array('ImagesNews');

}

class ImagesNews extends Zend_Db_Table_Abstract{

    protected $_name = 'news_imagens';
    protected $_primary = 'id_new';

    protected $_referenceMap    = array(
        'Arquivos' => array(
            'columns'           => 'id_new',
            'refTableClass'     => 'App_Model_News',
            'refColumns'        => 'id'
        ));    
}

Is there any way to add the images inside the news rows? Then at the view I could loop and print the images.

Thanks and best regard’s.
Sorry for my bad english.

  • 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-21T16:47:11+00:00Added an answer on May 21, 2026 at 4:47 pm

    I think that what you could do is to create your own custom News row class:

    class App_Model_Row_News extends Zend_Db_Table_Row_Abstract {
         public $images;
    }
    

    Then you would tell App_Model_News to use the custom row class:

    class App_Model_News extends Zend_Db_Table_Abstract{
    
        protected $_name = 'news';
        protected $_primary = 'id';
        protected $_rowClass = 'App_Model_Row_News';
    
        protected $_dependentTables = array('ImagesNews');
    
    }
    

    Hope this helps.

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

Sidebar

Related Questions

This is an already posted question but I need to understand what is going
Sorry, for double posting, already posted this question once, but I realized I weren't
I had posted the question once to http://doctype.com/within-same-line-have-center-element-right-most-element , but didn't get a good
Before I post this question, I found somehow similar question posted here . But
I have been looking all over the Internet for an answer to this question
Apologies if this question is already posted. I didn't find the answer i was
This post relates to a previous that i posted but the question is different
Once again a very beginner-ish question, but here I go: I would like to
This is a spin off from another question I posted a few days ago
I posted a question before but I am yet limited to mix the code

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.