Review main Abandoned

61443[FEATURE] Allow special ordering in Extbase

Tizian Schmidlin CR 0 V 0 Normal +118 −10 updated 07/04/23, 07:42

Commit message

7 years ago I published a feature request on forge.typo3.org and I
finally came around to write a proper implementation, that supports more
than just "I'd like to have concat in Extbase orderings". The idea is to
offer a way to have an easy way to have complex orderings as they happen
in SQL and applications, without being limited by the Object Model
regarding ordering.

This change shouldn't break anything since all it does is open the API
to new functionality. The idea is that with this feature, a developer is
able to pass a native ordering to extbase and it will treat it like that
and just pass it to Doctrine DBAL.

Some examples that work with this, but didn't before:

This would return all results, ordered by the concatenated fields
`field1`, `field2` and `field3`:

.. code-block:: php

   $query = $this->createQuery();
   $query->setOrderings([ 'CONCAT(field1, field2, field3)' =>
   QueryInterface::EXTBASE_ORDER_DESCENDING_NATIVE]);

   return $query->execute();

Until now, this would render an Extbase Exception because it would try
to convert `CONCAT` into `c_o_n_c_a_t`.

This also works with other cases like this, like ordering by specific
uids:

.. code-block:: php

   $query = $this->createQuery();
   $query->setOrderings([ 'uid = 1, uid = 4, uid = 3, uid = 5' =>
   QueryInterface::EXTBASE_ORDER_DESCENDING_NATIVE]);

   return $query->execute();

Review

  • Code review CR 0

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V 0

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 4