Display objects from the last one added

Please tell me how to display objects so that the last one added is the first one. Now it's the opposite.

Example

It is necessary that it is not as in the picture, but on the contrary => 6, 5, 4, 3, 2, 1.

Twig code

<section class="section section--donaters" data-section="donaters">
   <div class="section-body">
      <div class="container">
        <div class="donaters">
          <div class="section-title text--blue donaters-title">
             <h4 data-title>{{ ourDonaters.value }}</h4>
           </div>
           <div class="section-content">
            <div class="items-list" data-list>

             {% embed "donaters.twig" with donaters %} {% endembed %}

             {% if donaters.page_count > 1 %}
             <!-- pagination -->
             <div class="pagination text--center" data-pagination>
              <ul class="hidden" data-pages>
               {% for page in 1..donaters.page_count-1 %}
                 <li><a href="/donaters/{{ page }}">{{ page }}</a></li>
               {% endfor %}
              </ul>
              <button type="button" class="btn btn--white-orange btn--small btn--block btn--pager" data-button="pager">
              <span>Загрузить еще</span> <i class="icon icon-spinner"></i>
              </button>
             </div><!-- /pagination -->
           {% endif %}
         </div>
       </div>
      </div>
     </div>
    </div>
   </section>

Symfony code

final public function getDonaters($page = 0, $onPage = 6)
{
 $items = $this->getObjects($this->_containerID, $this->_projectClassID, true, [$page * $onPage, $onPage]);
 $count = $this->getObjectsCount($this->_containerID, $this->_projectClassID);
        
 return [
 'items' => $items,
 'on_page' => $onPage,
 'page_count' => ceil($count / $onPage),
 'count' => $count,
  ];
    }
Author: thmskor, 2020-11-27

1 answers

The actual answer is

final public function getDonaters($page = 0, $onPage = 6)
{
    $items = $this->getObjects($this->_containerID, $this->_projectClassID, true, [$page * $onPage, $onPage], ['o.sort' => 'desc']);
    $count = $this->getObjectsCount($this->_containerID, $this->_projectClassID);

    return [
        'items' => $items,
        'on_page' => $onPage,
        'page_count' => ceil($count / $onPage),
        'count' => $count,
    ];
}
 0
Author: thmskor, 2020-11-27 22:46:46