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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:06:00+00:00 2026-05-29T17:06:00+00:00

I have three objects – Calendar, Event and Occurrence. A calendar has many events

  • 0

I have three objects – Calendar, Event and Occurrence. A calendar has many events and each event has many occurrences. Now in CalendarMapper, I want to create a calendar object that automatically populates the events array inside, and each event’s occurrences are also automatically populated.

I read about getParentRow and tried something like this in Application_Model_CalendarMapper:

    public function fetchAllWithEvents($id)
    {
      $resultSet = $this->getDbTable()->fetchAll();
      $entries   = array();
      foreach ($resultSet as $row) {
                $entry = new Application_Model_Calendar();
                $events = $row->findParentRow('Application_Model_DbTable_Events');
    ...

The above line however does not seem to go through EventMapper (atleast not fetch/fetchAll), so it just gets an array containing the events.

So, how do I insert the occurrence data into each event here?
Is the correct way to call EventsMapper directly (and EventsMapper uses OccurrenceMapper to populate Occurrences)?

Does that mean the referenceMap is not of much use in this context?

$entry->setEvents($events); 

I want to do this, but the $events should be an array of Event objects which it currently is not.

The Dbtable classes

Calendar:

class Application_Model_DbTable_Calendars extends Zend_Db_Table_Abstract
{
    protected $_name = 'phpc_calendars';
    protected $primary_key = 'cid';
    protected $_referenceMap = array (
        'Events'=> array (
            'columns'=>'cid',
            'refTableClass'=>'Application_Model_DbTable_Events',
            'refColumns'=>'cid'
        )
    );
}

Events:

class Application_Model_DbTable_Events extends Zend_Db_Table_Abstract
{
    protected $_name = 'phpc_events';

    protected $primary_key = 'eid';
    protected $_dependentTables = array ('Calenars');
    protected $_referenceMap = array (
        'occurrences'=> array (
            'columns'=>'eid',
            'refTableClass'=>'Application_Model_DbTable_occurrences',
            'refColumns'=>'eid'
        )
    );
}

Occurrences:

class occurrences extends Zend_Db_Table_Abstract
{
    protected $_name = 'phpc_occurrences';

    protected $primary_key = 'ocid';
    protected $_dependentTables = array ('Events');
}
  • 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-29T17:06:01+00:00Added an answer on May 29, 2026 at 5:06 pm

    Could not find a satisfactory way to do this. So, I implemented it myself without using referenceMaps

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

Sidebar

Related Questions

Basically I have some class objects, each with three properties. Once one class object
I have got three similar json objects. Now i wish to join the entire
I have three projects in my C# 4 solution. MooDB: Has my domain objects
I have three domain objects: Child, Classroom and ChildClassroom. Here are lists of each:
I have three arrays each having SimpleXML Objects in them. They are structured like
I have a dictionary with three objects, and I want to add this dictionary
iSo let's say I have three different arrays of objects, and I want to
I am attempting a many-to-many list in one of my objects. I have three
In my application, I have three collection objects which store data. The data which
I have three ObservableCollections: CharacterCollection, LocationCollection, and ItemCollection. They are all collections of objects;

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.