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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:52:47+00:00 2026-06-13T14:52:47+00:00

I am just getting started with developing with Zend Framework 2 and I’ve run

  • 0

I am just getting started with developing with Zend Framework 2 and I’ve run into a roadblock.

At it’s simplest expression, the fetchAll function works:

public function fetchAll()
{
    $resultSet = $this->tableGateway->select();
    return $resultSet;
}

However, when I attempt to mix in the join in the following way:

public function fetchAll()
{
    $sql = new Sql($this->tableGateway->getAdapter());

    $select = $sql->select();
    $select->from('Entreprise')
        ->columns(array('id', 'nom', 'categorie_id'))
        ->join(array('C' => 'Categorie'), 'categorie_id = C.id', array('categorie' => 'nom'), \Zend\Db\Sql\Select::JOIN_INNER);
    $resultSet = $this->tableGateway->selectWith($select);
    return $resultSet;
}

The resulting query is:

SELECT "Entreprise"."id" AS "id", "Entreprise"."nom" AS "nom", "Entreprise"."categorie_id" AS "categorie_id", "C"."nom" AS "categorie" FROM "Entreprise" INNER JOIN "Categorie" AS "C" ON "categorie_id" = "C"."id"

The table names, columns are fine since the query doesn’t throw an error, but instead simply returns an empty result set. Even removing the join and just leaving the following code doesn’t help.

public function fetchAll()
{
    $sql = new Sql($this->tableGateway->getAdapter());

    $select = $sql->select();
    $select->from('Entreprise');
    $resultSet = $this->tableGateway->selectWith($select);
    return $resultSet;
}

Which makes me believe it’s simply something wrong with how I get the adapter or instantiate the select, but I just can’t seem to figure it out or find any solution.

Can anyone help me figure what I’m doing wrong?

  • 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-13T14:52:48+00:00Added an answer on June 13, 2026 at 2:52 pm

    The following code works perfectly:

    public function fetchAll()
    {
        $sql = new Sql($this->tableGateway->getAdapter());
    
        $select = $sql->select();
        $select->from('Entreprise')
            ->columns(array('id', 'nom', 'categorie_id'))
            ->join(array('C' => 'Categorie'), 'categorie_id = C.id', array('categorie' => 'nom'), \Zend\Db\Sql\Select::JOIN_INNER);
        $resultSet = $this->tableGateway->selectWith($select);
        return $resultSet;
    }
    

    …it was a typo that had been entered by accident in another file…

    Thanks Sam for the lead, ridiculously simple, but I just didn’t think of trying!

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

Sidebar

Related Questions

I'm just getting started developing for Android and I'm running into a weird problem.
I'm building a site, and have just started getting into developing the backend. The
I am just getting started developing my first Android app, and one function that
HI all, I'm just getting started with developing for Android. I'm looking to port
I'm just getting started with the Play Framework 2.0 (using current trunk 2.1-SNAPSHOT, Scala)
I am just getting started couchdb and have been looking into writing couch apps.
I am just getting started with Play Framework. I have downloaded and installed play
I am just getting started on javascript, and I have experience in developing systems
Just getting started with WF4. Ran into a problem with passing some text from
I'm just getting started with the Delphi Spring Framework and was wondering whether the

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.