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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:12:07+00:00 2026-06-09T18:12:07+00:00

I use Doctrine in Symfony2. Here is the code: $repository = $this->getDoctrine()->getRepository(‘AcmeCrawlerBundle:Trainings’); $allActive =

  • 0

I use Doctrine in Symfony2. Here is the code:

$repository = $this->getDoctrine()->getRepository('AcmeCrawlerBundle:Trainings');
$allActive = $repository->findByStatus('(Active)');

How can I take allByStatus WITH minimal realId? I mean, one row by status “(Active)” and minimal “realId”.

Thank you!

Upd. I’m so stu… I can find just first and watch it’s realId, cause i saved it in cycle… Thank you for advice!

  • 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-09T18:12:09+00:00Added an answer on June 9, 2026 at 6:12 pm

    You can overload the findByStatus function in your repository to use an orderby close in your query builder

    <?php class TrainingsRepository { 
      /*other code here */
      public function findByStatus($status){
         $qb =  $this->createQueryBuilder('t');
         $qb->addWhere('t.status=:status');
         $qb->orderBy('idItem','ASC');
         $qb->setParameters(array(':status'=>$status));
    
        return $qb->getQuery()->getResult();
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working in the Symfony2 framework and wondering when would one use a Doctrine
I'm new here and on a research trip. We would like to use Symfony2
I must use \Doctrine\Common\Annotations\AnnotationRegistry::registerFile to access the annotation registry in entity files. This part
I could use some help on this problem. I'm creating an application using Symfony2
I have an object from inside a Symfony2 project. Here follows the code. namespace
I just started to use symfony 1.4 and Doctrine. (Used 1.0 - 1.2 +
i want to use doctrine with my mamp. but according to doctrine's documentation it
I have a number of simple controller classes that use Doctrine's entity manager to
So, I'm trying to use Doctrine to retrieve some data. I have some basic
I have the following two entities: <?php namespace Site\AnnonceBundle\Entity; use Doctrine\ORM\Mapping as ORM; use

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.