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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:26:26+00:00 2026-05-31T03:26:26+00:00

I am using Doctrine 2 to manage my entity and Zend_Auth to manage authorisation.

  • 0

I am using Doctrine 2 to manage my entity and Zend_Auth to manage authorisation. I can easily get a full details of a user using

$user = $this->em->getRepository('Entities\User')->findOneByUsername($username));

I successfully authorise, and then want to store the user so that I can access certain details

$storage = $auth->getStorage();
$storage->write($user);

This is all working fine, but I am concerned about storing the complete user details into Zend_Auth storage.

My thought was to limit the columns returned by findOneByUsername (removing password, and other results). Reading the Doctrine documentation, this does not seem to be possible. I have also looked at queryBuilder (and can build a suitable query), but once again seem to only be able to SELECT all.

What is the best way to limit a query result to a few column?

  • 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-05-31T03:26:28+00:00Added an answer on May 31, 2026 at 3:26 am

    Storing a user object in the session is not a good practice. You should just store the user id and query the database if needed and store the user object in an instance variable. There are a lot of example here how to write a custom select. Note that the type given back by $query->getResult() depends on the select statement… if you don’t select all fields an array will be returned.

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

Sidebar

Related Questions

I'm using Doctrine 2. I want to get all Entities of an entity class
I'm using Doctrine 2 ORM and I have this problem. I have three Entities,
Using Doctrine 2 I want to get some users that are contacts of another
Im using Doctrine and i dont quite understand this code here: $this->hasColumn('id', 'integer', 8,
I'm using Doctrine 2 and single table inheritance, my topmost entity hierarchy is: JS_File
I'm using Doctrine ODM with MongoDB. I have a product model like this: namespace
I am using Doctrine 1.2, how could I get the query object into json
I must use \Doctrine\Common\Annotations\AnnotationRegistry::registerFile to access the annotation registry in entity files. This part
I am using Doctrine with Symfony2. My config.yml file looks something like this:- Doctrine
I'm using Doctrine for database abstraction. Now I'd like to get the auto_increment primary

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.