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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:33:16+00:00 2026-06-11T10:33:16+00:00

I’ve followed the Album example that was created for the new ZF2 tutorial. For

  • 0

I’ve followed the Album example that was created for the new ZF2 tutorial. For first module, it all worked great and I was able to modify to show the data that I want to use for my application.

My problem is adding a second module, and, more complex, it managing 2+ tables of data. Each time I go to the page, I get the Apache error page, which isn’t very helpful. The only main Class I modified was the Module.php int he second module’s directory. Maybe someone can see how wrong my guess was.

Background on the module: The view will show 4 types of tables that include Fosters and Volunteers. I created a Model and Table for each. All seems to be pretty good, except I did modify the factories setting to include each Table (FosterTable and VolTable). Do you think this is were my error could be?

I was working form this page: http://framework.zend.com/manual/2.0/en/user-guide/database-and-models.html

For the /TeamMgr/Module.php, I added the following:

namespace TeamMgr;

use TeamMgr\Model\FosterTable;
use TeamMgr\Model\VolTable;

class Module
{
 public function getServiceConfig()
    {
        return array(
            'factories' => array(
                'TeamMgr\Model\VolTable' =>  function($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $table     = new VolTable($dbAdapter);
                    return $table;
                },

                'TeamMgr\Model\FosterTable' =>  function($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    $table     = new FosterTable($dbAdapter);
                    return $table;
                },
            ),
        );
    }

    public function getConfig()
    {
        return include __DIR__ . '/config/module.config.php';
    }
}

Then in my controller I added:

public function indexAction(){
    return new ViewModel(array(
            'fosters'=>$this->getFosterTable()->fetchAll(),
    ));
    return new ViewModel(array(
            'vols'=>$this->getVolTable()->fetchAll(),
    ));     

}

So how completely off am I?

  • 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-06-11T10:33:17+00:00Added an answer on June 11, 2026 at 10:33 am

    You can’t call return more than once. What is happening is that the execution of the function is terminated with the first return call and the second one is never called. You need to write:

    return new ViewModel(array(
            'fosters'=>$this->getFosterTable()->fetchAll(),
            'vols'=>$this->getVolTable()->fetchAll(),
    ));
    

    It’s basic PHP. So I’d suggest to learn PHP first, before learning ZF. ZF is very complex even for someone seasoned in plain vanilla PHP. There are better frameworks for beginners (like code igniter, kohana or cakephp) – you should start there IMO…

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a
We're building an app, our first using Rails 3, and we're having to build

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.