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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:55:08+00:00 2026-06-03T07:55:08+00:00

I am able to fetch my data from database by using this structure: $user

  • 0

I am able to fetch my data from database by using this structure:

$user = $this->getDoctrine()
->getRepository('AcmeDemoBundle:Emails')
->find(8081);

When I do that, I am able to get my data like this:

$user->getColumnNameHere();

Basically, I am able to use Entity Class.

But if I want to use QueryBuilder instead of find I am only getting associative arrays.

$product->createQueryBuilder('p')
        ->setMaxResults(1)
        ->where('p.idx = :idx')
        ->select('p.columnNameHere')
        ->setParameter('idx', 8081)
        ->orderBy('p.idx', 'DESC')
        ->getQuery();
        $product = $query->getResult();

$product returns as array. Is it possible to fetch it with Entity Manager Class? If yes, how?

I digg the documentation but it seems not possible or not exist in the doc or I’m just blind 🙂

  • 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-03T07:55:09+00:00Added an answer on June 3, 2026 at 7:55 am

    Yes you can, usually using:

    $repository
        ->createQueryBuilder('p')
        ->getQuery()
        ->execute()
    ;
    

    This should return you an array of entities.

    If you want to get a single entity result, use either getSingleResult or getOneOrNullResult:

    $repository
        ->createQueryBuilder('p')
        ->getQuery()
        ->getOneOrNullResult()
    ;
    

    Warning: These method can potentially throw NonUniqueResultException.

    Edit: Ok, so the question was about partial objects: http://docs.doctrine-project.org/en/latest/reference/partial-objects.html

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

Sidebar

Related Questions

I have written some thing like this to fetch data from the database. public
I want to be able to separate the birthday from the mysql data into
My table is being populated using ajax from a mysql database. I have a
I'm dealing with highcharts with dynamic data (values retrieved from database). By writing a
I fetch data from a Core Data-base and present them in a UITableView .
How do I able to fetch all the messages with SEVERITY is ERROR only.
I would like to be able to fetch a web page's html and save
I need to be able to compile a visual studio 2005 c++ project from
I have created an application where i am fetching some data from a webservice,which
I'm tasked with reporting on survey data using Reporting Services 2008. My challenge is

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.