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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:58:28+00:00 2026-06-07T00:58:28+00:00

Ok Im still new to Zend, and trying to find how the ORM works

  • 0

Ok Im still new to Zend, and trying to find how the ORM works in general for it, seems to be posing a difficult task (anyone know where they have a specific document for it). That aside what I am trying to do is take an existing query and add a “AND” clause to it. Just not sure how to go about doing that, as the examples I have found else where dont look like this one, and I’d rather avoid breakage on this

$select = $this->select()
            ->from('offer_term')
            ->setIntegrityCheck(false)
            ->joinUsing('term_mapping', 'term_id')
            ->where('promo_id = ?', $promo_id);
        return $this->fetchAll($select);
  • 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-07T00:58:30+00:00Added an answer on June 7, 2026 at 12:58 am

    Actually this is really easy once you start understand how Zend_db works.

    your query:

    $select = $this->select()
                ->from('offer_term')
                ->setIntegrityCheck(false)
                ->joinUsing('term_mapping', 'term_id')
                ->where('promo_id = ?', $promo_id);
            return $this->fetchAll($select);
    

    you are already using the select() object for performing the query, so try refactoring to something like this(I’ll include how do it with a conditional as well):

    $select = $this->select()->setIntegrityCheck(false);
    $select->from('offer_term');//if query is inside of a DbTable model the from() can be omitted
    $select->joinUsing('term_mapping', 'term_id');
    $select->where('promo_id = ?', $promo_id);//Every time you add a where(), select() adds the param using the AND operator
    $select->where('something_new = ?', $new_param);//if you need to add a param using OR you can use the orWhere() method.
    if (TRUE) {
        $select->orWhere('something = ?',$parameter);//This will add an OR WHERE to the query if the condition is true.
    }
    return $this->fetchAll($select);
    

    Adding an AND in a select() query is done just by adding another where() to the chain. This can be done by chaining as your original query does or by using separate statements as I have done. If you need to use the OR operator in select() query you can use the orWhere() method.

    You can mix chaining and separate statements as needed, which makes adding a conditional pretty easy.

    NOTE: Zend_Db is not an ORM, it is an implementation of The table gateway and table row patterns (I hope I got the names correct). So please do not expect full ORM functionality.

    Hope this helps.

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

Sidebar

Related Questions

I am new to Zend Framework. I am trying to integrate TCPDF with my
I am still very new to Zend Framework and work on my first small
still new to XML parsing with the iphone so i have a few questions.
I still new using Asp.net with vb.net Protected Sub login_Click(ByVal sender As Object, ByVal
I am still new into Codeigniter framework. Today I read about Database Caching http://codeigniter.com/user_guide/database/caching.html
I am still new at SAS and I was wondering how I can do
I'm still new to Core Data, so forgive the question. I'm building an app
i am still new to the Java language and libraries... i often use this
I am still new to Objective C and I was wondering if there were
I am still new to LINQ, and I have wrestled with a query for

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.