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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:33:15+00:00 2026-05-13T11:33:15+00:00

Lets say i’m listing musical artists, each artist has basic information like Name, Age

  • 0

Lets say i’m listing musical artists, each artist has basic information like Name, Age etc. stored in an artist table. They also have entries in an Albums table (album name/album cover etc), referencing the artist table using the artist id as a foreign key.

I have the Model_Artist (Artist.php) file:

class Model_Artist extends Zend_Db_Table_Abstract
{
    protected $_name = 'artist';
    protected $_dependentTables = array('Model_ArtistAlbums');
    public function fetchArtistss()
    {
        $select = $this->select();
        return $this->fetchAll($select);
    }
}

and to the Model_ArtistAlbums (ArtistAlbums.php) file

class Model_ArtistAlbums extends Zend_Db_Table_Abstract
{
    protected $_name = 'albums';

    protected $_referenceMap = array(
        'Artists' => array(
            'columns'       => 'alb_art_id',
            'refTableClass' => 'Model_Artist',
            'refColumns'    => 'art_id'
        )
    );
    // etc
}

in my controller:

public function indexAction()
{
    /* THIS WORKS
    $art = new Model_Artist();
    $artRowset = $art->find(1);
    $art1 = $artRowset->current();
    $artalbums = $art1->findDependentRowset('Model_ArtistAlbums');
    foreach($artalbums as $album){
        echo $album->alb_title."<br>";
    }
    */
    $arts = new Model_Artist();
    $this->view->artists = $arts->fetchArtists();
}

in the view file:

$this->partial()->setObjectKey('artist');
echo $this->partialLoop('admin/list-artists.phtml', $this->artists);

but with this code in artists/list-artists.phtml:

foreach($this->artist->findDependentRowset('albums') as $album):
// other stuff
endforeach;

i get this error:

Fatal error: Call to a member function
findDependentRowset() on a non-object

A var_dump of $this->artist = NULL.

  • 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-13T11:33:15+00:00Added an answer on May 13, 2026 at 11:33 am

    in you calling view:

    <?php $this->partialLoop()->setObjectKey('artist'); ?>
    <?php echo $this->partialLoop('yourpartial.phtml', $artists); ?>
    

    Note – i beleive this changes the object key globally for the instance of the partialLoop helper so you might want to pick something more generic than artist or remember to reset it if you use partialLoop for something else later in the same view.

    and in your partial:

    <?php foreach($this->artist->findDependentRowSet('Albums') as $album): ?>
     <!-- looping stuff here -->
    <?php endforeach; ?>
    

    Check the docs/api for Zend_Db_Table_Row for what the actual argument(s) to findDependentRowset should be in terms of your projects model naming conventions. You may also need to set some things up in your table class if you havent already defined the _referenceMap.

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

Sidebar

Related Questions

Lets say i have a form which have the following : Name:TextBox Email:TextBox Age:TextBox
Lets say I have the following code: abstract class Animal case class Dog(name:String) extends
Lets say I have an array like this: string [] Filelist = ... I
Lets say I have 2 mobile phones which are 50 meters away from each
Lets say there was an architecture XYZ which was optimised for functional languages (like
Lets say I have a p tag like this: <div id = example> <p
Lets say I have two tables in Postgres: Name: table_rad Column Type id integer
Lets say when I run the following query, SELECT NAME FROM EMP; It return
Lets say you have website that keeps balance for each user. You give each
Lets say I have a Dictionary object: Dictionary myDictionary<int, SomeObject> = new Dictionary<string, SomeObject>();

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.