Project

General

Profile

Actions

Bug #75163

closed

Extbase Repository Default Orderings and the lastUpdated Column

Added by Karsten Beyer over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2016-03-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

In my project i have mapped the pages table to a local domain object in order to show for example related pages using a extbase plugin.

I would like to sort the results by the lastUpdated column, however this seems to be impossible with the extbase repository as it automatically converts the camelcase notation to an underscore form:

lastUpdated => last_updated

Which then results in an error...

This is the setting in the repository:

@class PageRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {

@ protected $defaultOrderings = array("lastUpdated"=> \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING );

and this the resulting exception:

#1247602160: Unknown column 'pages.last_updated' in 'order clause' (More information)

Actions #1

Updated by Mathias Brodala over 8 years ago

  • Status changed from New to Needs Feedback

Have you tried specifying a mapping to prevent this automatic conversion? Thus something like:

plugin.tx_myext {
  persistence {
    classes {
      Vendor\MyExt\Domain\Model\Page {
        mapping {
          tableName = pages

          columns {
            lastUpdated.mapOnProperty = lastUpdated
          }
        }
      }
    }
  }
}

In general you should first try to ask e.g. in https://typo3.slack.com/messages/typo3-cms/ for support. This tracker is only meant for reporting issues.

Actions #2

Updated by Wouter Wolters over 8 years ago

  • Status changed from Needs Feedback to Closed

The example Mathias provides should solve the issue you have. I'm closing this ticket now because this is not a core bug.

Actions

Also available in: Atom PDF