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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:31:24+00:00 2026-06-13T10:31:24+00:00

I have a very basic table with few columns. It has 15 records in

  • 0

I have a very basic table with few columns. It has 15 records in it.

Now, if i use this query:

SELECT * FROM excursions WHERE lang_id = 1

It returns 5 records as i expected.

But, when i use doctrine2, it creates a query like this:

SELECT
e0_.idx AS idx0,
e0_.place_id AS place_id1,
e0_.lang_id AS lang_id2,
e0_.excursion_name AS excursion_name3,
e0_.excursion_type AS excursion_type4,
e0_.excursion_text_short AS excursion_text_short5,
e0_.start_date AS start_date6,
e0_.end_date AS end_date7,
e0_.override_place AS override_place8,
e0_.languages AS languages9,
e0_.meeting_place AS meeting_place10,
e0_.excursion_text AS excursion_text11,
e0_.starts_at AS starts_at12,
e0_.category_id AS category_id13,
e0_.map_link AS map_link14,
e0_.capacity AS capacity15,
e0_.pick_up_time AS pick_up_time16,
e0_.is_activity AS is_activity17
FROM excursions e1_, excursions e0_
WHERE e0_.lang_id = 1

Now, when i execute this, it returns 25 records! 5 copy for each record. They are exactly same but instead of 5 it returns 25 records. (5×5)

Oh yes, if i remove excursions e1_ it returns 5 records totally. But why?

Can anyone look at that query, did i miss something here?

I used QueryBuilder().

$qb = $this->getRepository()->createQueryBuilder('Excursions');
$qb->select('e')->from('Web\Bundle\ExcursionBundle\Entity\Excursions', 'e');
$qb->andWhere("e.langId = 1");

Note: I did other styles with or without QueryBuilder(). Results are always same. PHP got 1 copy of each. Query that i execute on server side gets 5 copy of each record.

I am asking this because, if doctrine gets multiple times, what if i fetch my whole table like 500 records? It will probably grab 500x5. Wouldn’t be slowdown the process?

  • 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-13T10:31:26+00:00Added an answer on June 13, 2026 at 10:31 am

    There is not needed line. The correct code would be:

    $qb = $this->getRepository()->createQueryBuilder('e');
    $qb->andWhere("e.langId = 1");
    

    What you do in your code is adding the “from” part twice. Once it is done by Doctrine when you execute “createQueryBuilder” method (it adds “select” and “from” itself). You pass the alias “Excursions” which is never used. Then you add the second “from” with alias “e“.

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

Sidebar

Related Questions

I have a messaging system (very basic) that has a table like this: **MESSAGE_ID**
I have a very basic MySQL Database. This is the query I used to
This a very basic database design/normalisation question. Suppose I have a Books table with
I have a very basic Table structure to be placed in middle/center of the
I have a very basic mysql table called memberships, that tracks which people belong
I'm working on a very basic shopping cart system. I have a table items
I have a very basic API in my app which also has an index
I have only one table in my mySql database for a very basic website
This seems very basic but I can't figure it out. I've got a table
I have a very basic SSIS package with one data flow task (from an

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.