How to order results with findBy() in Doctrine

0 votes

I am using the findBy() method on a Doctrine repository:

$entities = $repository->findBy(array('type'=> 'C12'));

How can I order the results?

Apr 20 in PHP by kartik
• 26,540 points
208 views

1 answer to this question.

0 votes

Hii @kartik,

Try out this code

$ens = $em->getRepository('AcmeBinBundle:Marks')
              ->findBy(
                 array(),
                 array('id' => 'ASC')
               );
Hope this work!!

Thank You!!

answered Apr 20 by Niroj
• 57,260 points

Related Questions In PHP

0 votes
1 answer

How to Validate Form Data With PHP?

Hey @kartik, The first thing we will do ...READ MORE

answered Feb 13 in PHP by Niroj
• 57,260 points
173 views
0 votes
1 answer

What is a Cookie? How to create Cookies With PHP?

A cookie is often used to identify ...READ MORE

answered Feb 13 in PHP by Niroj
• 57,260 points
230 views
0 votes
1 answer

How to merge two arrays while keeping keys instead of reindexing in php?

Hello, Considering that you have $replaced = array('1' => ...READ MORE

answered Apr 1 in PHP by Niroj
• 57,260 points
86 views
0 votes
1 answer

How to prevent XSS with HTML/PHP?

Hello, HTML Encoding htmlspecialchars will convert any "HTML special characters" ...READ MORE

answered Apr 1 in PHP by Niroj
• 57,260 points
125 views
0 votes
1 answer

Why it is necessary to refresh CSRF token per form request?

Hello, Generating a new CSRF token for each ...READ MORE

answered Mar 19 in Laravel by Niroj
• 57,260 points
751 views
0 votes
1 answer

What is meant by passing the variable by value and reference in PHP?

Hello, When the variable is passed as value ...READ MORE

answered Mar 27 in PHP by Niroj
• 57,260 points
113 views
0 votes
1 answer

Connection with MySQL server using PHP. How can we do that?

Hey @kartik, You have to provide MySQL hostname, ...READ MORE

answered Mar 27 in PHP by Niroj
• 57,260 points
80 views
0 votes
1 answer

How to retrieve or obtain data from the MySQL database using PHP?

Hello kartik,  Actually there are many functions that  ...READ MORE

answered Mar 27 in PHP by Niroj
• 57,260 points
90 views
0 votes
1 answer

How to log in to phpMyAdmin with WAMP?

Hello @kartik,  Try-Username: root Password: (No password set). Sometimes it doesn't ...READ MORE

answered Apr 9 in PHP by Niroj
• 57,260 points
315 views
0 votes
1 answer

How to output MySQL query results in CSV format?

Hello @kartik, Using this command columns names will ...READ MORE

answered Aug 18 in PHP by Niroj
• 57,260 points
48 views