1
0
Fork 0
mirror of https://codeberg.org/demostf/api.git synced 2026-06-04 10:24:07 +02:00

add ability to filter before/after id

This commit is contained in:
Robin Appelman 2022-06-28 20:03:52 +02:00
commit d3d2b59e83
2 changed files with 16 additions and 0 deletions

View file

@ -124,6 +124,14 @@ class DemoListProvider extends BaseProvider {
$query->andWhere($query->expr()->gt('created_at',
$query->createNamedParameter($where['after']->format(\DATE_ATOM))));
}
if (isset($where['before_id'])) {
$query->andWhere($query->expr()->lt('id',
$query->createNamedParameter($where['before_id'], PDO::PARAM_INT)));
}
if (isset($where['after_id'])) {
$query->andWhere($query->expr()->gt('id',
$query->createNamedParameter($where['after_id'], PDO::PARAM_INT)));
}
}
/**