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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:36:04+00:00 2026-06-04T04:36:04+00:00

Hello! I’ve tried to set a DQL query using QueryBuilder but so far no

  • 0

Hello!

I’ve tried to set a DQL query using QueryBuilder but so far no good…
The query I’d like to have looks like this:

$queryBuilder = Zend_Registry::get('entityManager')->createQueryBuilder();
$queryBuilder->select('s.*');
$queryBuilder->from('GPos_Model_Sale', 's');
$queryBuilder->where('s.store = ?', $authNamespace->store); //breaks on this line
$queryBuilder->andWhere('s.seller = ?', $seller->getId());
$queryBuilder->andWhere('((s.date >= ?', $dateStart);
$queryBuilder->andWhere('s.date <= ?', $dateEnd);
$queryBuilder->andWhere('s.status = "closed") OR s.status = "onhold")');
$queryBuilder->groupby('s.id');
return $queryBuilder->getQuery()->getResult();

Note: I know I could use the ->andWhere etc one after another but it was just for XDebug purpose.
Note2: $authNamespace->store stands for a GPos_Model_Store entity’s ID.

Anyways, I get an Exception on $queryBuilder->where('s.store = ?', $authNamespace->store) stating : “Expression of type ” not allowed in this context.”

I tried using an entity itself instead but then I received a “Expression of type ‘GPos_Model_Store’ not allowed in this context.” exception…

Can any of you point out what I’m doing wrong here ?

Thank you!

  • 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-04T04:36:05+00:00Added an answer on June 4, 2026 at 4:36 am

    Found my mistake.

    Changed my query to:

    $queryBuilder = Zend_Registry::get('entityManager')->createQueryBuilder();
    $queryBuilder->select('s');
    $queryBuilder->from('GPos_Model_Sale', 's');
    $queryBuilder->where('s.store = :store');
    $queryBuilder->andWhere('s.seller = :seller');
    $queryBuilder->andWhere('((s.date >= :dateStart');
    $queryBuilder->andWhere('s.date <= :dateEnd');
    $queryBuilder->andWhere('s.status = \'closed\') OR s.status = \'onhold\')');
    $queryBuilder->groupby('s.id');
    $queryBuilder->setParameter('store', $store->getId());
    $queryBuilder->setParameter('seller', $seller->getId());
    $queryBuilder->setParameter('dateStart', $dateStart->format('Y-m-d H:i:s'));
    $queryBuilder->setParameter('dateEnd', $dateEnd->format('Y-m-d H:i:s'));
    return $queryBuilder->getQuery()->getResult();
    

    And now it works like a charm.

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

Sidebar

Related Questions

Hello! I'm not even sure if this is possible, but hopefully it is in
Hello I have been having trouble with this for a while now. I have
Hello I have this problem with PyQt4-dev-tools that include: * a user interface compiler
Hello i have this code var queue = new BlockingCollection<int>(); queue.Add(0); var producers =
Hello,I'd like to ask you two questions. (I am using java and jedis) I
Hello I have a double linked list set up, and i have a search
Hello guys i have set background image on my input text and text area
Hello good morning everyone, i have an iphone app which is still in development
hello i have a app that connects and post to user wall but when
Hello fellow developers, I am a little stumped on this one as I have

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.