Skip to content

Commit

Permalink
feat: array source
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreyu committed Oct 5, 2024
1 parent 4e1153e commit f166304
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Query/ArrayProxyQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public function sort(SortingData $sortingData): void
$valueB = $propertyAccessor->getValue($b, $propertyPath);

if ($valueA < $valueB) {
return $direction === 'asc' ? -1 : 1;
return 'asc' === $direction ? -1 : 1;
} elseif ($valueA > $valueB) {
return $direction === 'asc' ? 1 : -1;
return 'asc' === $direction ? 1 : -1;
}
}

Expand All @@ -68,4 +68,4 @@ public function getResult(): ResultSetInterface
totalItemCount: $this->totalItemCount,
);
}
}
}
1 change: 0 additions & 1 deletion src/Resources/config/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
->tag('kreyu_data_table.proxy_query.factory')
;


$services
->set('kreyu_data_table.proxy_query.factory.doctrine_orm', DoctrineOrmProxyQueryFactory::class)
->tag('kreyu_data_table.proxy_query.factory')
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Query/ArrayProxyQueryFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ public static function provideSupportsCases(): iterable
yield 'integer' => [123, false];
yield 'bool' => [true, false];
yield 'null' => [null, false];
yield 'object' => [new \stdClass, false];
yield 'object' => [new \stdClass(), false];
}
}
2 changes: 1 addition & 1 deletion tests/Unit/Query/ArrayProxyQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ public function testSortAndPaginate()
$this->assertEquals(1, $result->getCurrentPageItemCount());
$this->assertEquals(3, $result->getTotalItemCount());
}
}
}

0 comments on commit f166304

Please sign in to comment.