@@ -5207,12 +5207,14 @@ class DbAuthMiddleware extends Middleware
5207
5207
{
5208
5208
private $ reflection ;
5209
5209
private $ db ;
5210
+ private $ ordering ;
5210
5211
5211
5212
public function __construct (Router $ router , Responder $ responder , array $ properties , ReflectionService $ reflection , GenericDB $ db )
5212
5213
{
5213
5214
parent ::__construct ($ router , $ responder , $ properties );
5214
5215
$ this ->reflection = $ reflection ;
5215
5216
$ this ->db = $ db ;
5217
+ $ this ->ordering = new OrderingInfo ();
5216
5218
}
5217
5219
5218
5220
public function process (ServerRequestInterface $ request , RequestHandlerInterface $ next ): ResponseInterface
@@ -5242,7 +5244,8 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
5242
5244
$ columnNames = array_map ('trim ' , explode (', ' , $ returnedColumns ));
5243
5245
$ columnNames [] = $ passwordColumnName ;
5244
5246
}
5245
- $ users = $ this ->db ->selectAll ($ table , $ columnNames , $ condition , [], 0 , 1 );
5247
+ $ columnOrdering = $ this ->ordering ->getDefaultColumnOrdering ($ table );
5248
+ $ users = $ this ->db ->selectAll ($ table , $ columnNames , $ condition , $ columnOrdering , 0 , 1 );
5246
5249
foreach ($ users as $ user ) {
5247
5250
if (password_verify ($ password , $ user [$ passwordColumnName ]) == 1 ) {
5248
5251
if (!headers_sent ()) {
@@ -7051,6 +7054,7 @@ public function _list(string $tableName, array $params): ListDocument
7051
7054
class RelationJoiner
7052
7055
{
7053
7056
private $ reflection ;
7057
+ private $ ordering ;
7054
7058
private $ columns ;
7055
7059
7056
7060
public function __construct (ReflectionService $ reflection , ColumnIncluder $ columns )
@@ -7134,7 +7138,7 @@ private function addJoinsForTables(ReflectedTable $t1, PathTree $joins, array &$
7134
7138
foreach ($ joins ->getKeys () as $ t2Name ) {
7135
7139
7136
7140
$ t2 = $ this ->reflection ->getTable ($ t2Name );
7137
-
7141
+
7138
7142
$ belongsTo = count ($ t1 ->getFksTo ($ t2 ->getName ())) > 0 ;
7139
7143
$ hasMany = count ($ t2 ->getFksTo ($ t1 ->getName ())) > 0 ;
7140
7144
if (!$ belongsTo && !$ hasMany ) {
@@ -7152,11 +7156,11 @@ private function addJoinsForTables(ReflectedTable $t1, PathTree $joins, array &$
7152
7156
if ($ belongsTo ) {
7153
7157
$ fkValues = $ this ->getFkEmptyValues ($ t1 , $ t2 , $ records );
7154
7158
$ this ->addFkRecords ($ t2 , $ fkValues , $ params , $ db , $ newRecords );
7155
- }
7159
+ }
7156
7160
if ($ hasMany ) {
7157
7161
$ pkValues = $ this ->getPkEmptyValues ($ t1 , $ records );
7158
7162
$ this ->addPkRecords ($ t1 , $ t2 , $ pkValues , $ params , $ db , $ newRecords );
7159
- }
7163
+ }
7160
7164
if ($ hasAndBelongsToMany ) {
7161
7165
$ habtmValues = $ this ->getHabtmEmptyValues ($ t1 , $ t2 , $ t3 , $ db , $ records );
7162
7166
$ this ->addFkRecords ($ t2 , $ habtmValues ->fkValues , $ params , $ db , $ newRecords );
@@ -7167,11 +7171,11 @@ private function addJoinsForTables(ReflectedTable $t1, PathTree $joins, array &$
7167
7171
if ($ fkValues != null ) {
7168
7172
$ this ->fillFkValues ($ t2 , $ newRecords , $ fkValues );
7169
7173
$ this ->setFkValues ($ t1 , $ t2 , $ records , $ fkValues );
7170
- }
7174
+ }
7171
7175
if ($ pkValues != null ) {
7172
7176
$ this ->fillPkValues ($ t1 , $ t2 , $ newRecords , $ pkValues );
7173
7177
$ this ->setPkValues ($ t1 , $ t2 , $ records , $ pkValues );
7174
- }
7178
+ }
7175
7179
if ($ habtmValues != null ) {
7176
7180
$ this ->fillFkValues ($ t2 , $ newRecords , $ habtmValues ->fkValues );
7177
7181
$ this ->setHabtmValues ($ t1 , $ t2 , $ records , $ habtmValues );
0 commit comments