TableSort with entity query aggregate

ai flag

I'm trying to implement a table sort for a custom Drupal 9.x entity type Packet which represents published medical literature articles which have batched together and assigned for review. Each Packet has entity references to PacketArticle entities, and each of those has entity references to one or more Review entities. A Review has a reviewer (entity reference to a User), when the review was posted, and some other fields for the meat of the review. The user should be able to sort by the packet's name (one of the columns in the table) or by the date of the most recent review of any article in the packet (another of the columns in the table). The problem is that there is no documentation I have been able to find saying what should be given for the 'specifier' value in the $header array. I tried using the $alias variable from the $query->aggregate() call, but that gave me an error message complaining about illegal SQL. Where is the documentation I need, please? Thanks!


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.